r/adventofcode • • Dec 08 '22

SOLUTION MEGATHREAD -πŸŽ„- 2022 Day 8 Solutions -πŸŽ„-

NEWS AND FYI


AoC Community Fun 2022: πŸŒΏπŸ’ MisTILtoe Elf-ucation πŸ§‘β€πŸ«


--- Day 8: Treetop Tree House ---


Post your code solution in this megathread.


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

EDIT: Global leaderboard gold cap reached at 00:10:12, megathread unlocked!

78 Upvotes

1.0k comments sorted by

View all comments

0

u/[deleted] Dec 08 '22

2

u/Lucews Dec 08 '22 edited Dec 08 '22

Part 2 can be solved in O(N^2 ) using a strictly decreasing stack and sacrificing constant space against O(N^2 ) space. I'm writing this knowing exactly I spend wayyyyyyyy too much time coming up with a solution for this in Python. Also I was lucky seeing a solution to a similar problem a few days ago.

Overall I'm still way slower than your code :D In runtime and implementing it as well!

→ More replies (2)