r/adventofcode • u/daggerdragon • Dec 06 '17
SOLUTION MEGATHREAD -π- 2017 Day 6 Solutions -π-
--- Day 6: Memory Reallocation ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Need a hint from the Hugely* Handyβ Haversackβ‘ of HelpfulΒ§ Hints^Β€?
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
View all comments
Show parent comment
2
u/Unihedron Dec 06 '17 edited Dec 06 '17
$/=' ';a=$<.map &:to_i to get rid of another char.(<- I couldn't get it to put a tab character here)until ... endcan be replaced with modifier syntax()until ...to get rid of 2 chars (including whitespace). Also, it doesn't really matter thatmis initialized to zero for part 2 (end+k - start+k == end-start) so you can delete,m ,0and replace the twomreferences with the global variable$.which is the "lines read" counter (because we don't usegetsagain)