to get runtime complexity, count non-leaf nodes similar to decode ways, easier tho runtime recursion brute-force: 2^n. with memo: O(n)
holy fuck… i got
look at submission
e
237 Delete Node in a Linked List
have to set the next to null, if you want to remove a node. “node = null” does not work bc “node” is just a var and doesn’t alter the actual object, ~duh~. Could have used only two lines and no loop… silly boy..
DEFINITION OF ROOT-LEAF. IF THERE EXISTS ANOTHER CHILD, IT IS NOT A LEAF
e
2 diff ways with pri queue Do the calculation way
-best way to find how to get to target
bfs
e
difficult
e
e
e
e
e
interesting, reference the result array to make decisions and update, idk nothing to say
the zero case is absolute asshole not dealing with this,….. you need to have the index represent the length or you will kys aids
e
e
e
Use ‘nxt’ for next node name!
submitted: both dfs and bfs solutions