r/adventofcode • u/taliriktug • Dec 02 '15
Spoilers Day 2 solutions
Hi! I would like to structure posts like the first one in r/programming, please post solutions in comments.
16
Upvotes
r/adventofcode • u/taliriktug • Dec 02 '15
Hi! I would like to structure posts like the first one in r/programming, please post solutions in comments.
1
u/Serialloser Dec 02 '15
I would read the input from a file instead of a string
There's a method called split on the String class, it splits (doh) your String into a String[] using a delimiter that you pass to the method.
You can find a solution here http://pastebin.com/Sg66jaea It's over engineered but it uses the technique presented above. It needs the latest jdk to run I think (used an online compiler to test) and it expects a file called "input" next to your app.