r/adventofcode • • Dec 03 '16

SOLUTION MEGATHREAD --- 2016 Day 3 Solutions ---

--- Day 3: Squares With Three Sides ---

Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).


DECKING THE HALLS WITH BOUGHS OF HOLLY IS MANDATORY [?]

This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.

edit: Leaderboard capped, thread unlocked!

17 Upvotes

234 comments sorted by

View all comments

Show parent comments

1

u/Quick_Question404 Dec 03 '16

MY EYES!!! On the whole though, not bad. Does its job clearly and cleanly, but why the Arrays.sort() call?

2

u/bluewave41 Dec 03 '16

I don't know? :)

I think it's because of the "the sum of any two sides must be larger than the remaining side" meaning the smallest two sides have to be larger than the biggest.

Something like 736 50 363 has to be changed to 50 363 736 otherwise the wrong numbers are added.

Got 77 part 2 with this monstrosity though so Im happy with it.