Please turn JavaScript on
Another Casual Coder icon

Another Casual Coder

Receive updates from Another Casual Coder for free, starting right now.

We can deliver them by email, via your phone or you can read them from a personalised news page on follow.it.

This way you won't miss any new article from Another Casual Coder. Unsubscribe at any time.

Site title: Another Casual Coder

Is this your feed? Claim it!

Publisher:  Unclaimed!
Message frequency:  0.12 / day

Message History

Another problem where it gets easier if you map the tree to a HashTable. Keep in mind that this is an N-Ary tree, not binary. After that it is a straightforward pre-order depth-first-search (Pre-Order DPS). Code is down below, cheers, ACC.

Finish Time ...


Read full story
The solution to the problem below without the static "memo" (inspired by DP memoization) leads to TLE. Since the solution for test case N can be leveraged by test cases M (where M>N), you can use a static variable to cache some of the previously seen results. This is perfectly legal in LC land. Code is down below, cheers, ACC.

Read full story

Another problem that requires subset generation, and the same non-recursive technique is applied: go from 0 to 2^N-1, creating the subsets. N=12 so very small. I could have used StringBuilder to reduce the mem and processing pressure, but string worked fine too. Code is down below, cheers, ACC.


Read full story