I can't seem to wrap my head around this tree problem 😵💫 sort of understood first provided solution in recursion, but then got lost in recursion with memoization and dynamic programming.
#leetcode problem
https://t.co/Mjs3n68Gpt
Trippy. 😬
So instead of creating a visited object/array, we can mutate the '1's to '0's. Problem can be solved with #dfs and #bfs, same time but better space complexity. 🏝️
#leetcode problem
https://t.co/ARKmTBvzWf
Graphs.. I really need to get used to non-linear data structure moving forward. This problem took me a while to understand, and I could only understand the first iteration of possible solutions.
n is total of stones and e is edge
O(n ^ 2 + e) time and O(n + e) space complexity