#javascript
Read more stories on Hashnode
Articles with this tag
Difficulty: Easy · This problem can be solved using recursion. Thought process: Base case: Check if the number is 1. -OR- If the loop has been going on...
Difficulty: Easy · This can be solved recursively. Swap nodes and traverse left subtree then right subtree. Link: Invert Binary Tree /** * Definition...
Difficulty: Easy · This question can be solved via recursion depth first search. Keep track of the max depth. Traverse left sub tree then traverse right...
Difficulty: Medium · There's two ways to do this - iterative or recursive approach. Iterative: We will use a queue to keep track of the children's node...
Difficulty: Medium · We can use recursion to solve this, traversing the tree DFS. Thought process: Traverse the tree and increasing the depth each...
Difficulty: Medium · For this type of scheduling question, it can be solved using Topological Sort. It's basically Graph BFS problem. Though...