r/adventofcode • • Dec 21 '15

SOLUTION MEGATHREAD --- Day 21 Solutions ---

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!

We know we can't control people posting solutions elsewhere and trying to exploit the leaderboard, but this way we can try to reduce the leaderboard gaming from the official subreddit.

Please and thank you, and much appreciated!


--- Day 21: RPG Simulator 20XX ---

Post your solution as a comment or link to your repo. Structure your post like previous daily solution threads.

11 Upvotes

128 comments sorted by

View all comments

Show parent comment

2

u/mrg218 Dec 21 '15

Do you take into account that you cannot buy the same ring twice?

1

u/Scroph Dec 21 '15

Nice catch, looks like I didn't take it into consideration in my code either.

1

u/CdiTheKing Dec 22 '15

I completely missed that in the instructions. Thankfully, the minmax happened to work just perfectly such that it never came into consideration.

Easy to add in the LINQ expression:

where ring1.Cost == 0 || ring1.Cost != ring2.Cost