Tip 1: Graphs should be on your tips.
Tip 2: While explaining the solution to the interviewer, don't just hop onto the most optimal solution. Start with the brute force one, give the cons of the brute force solution, and then go step by step till you reach the optimal solution.
Tip 3: Improve your communication skills as well.
Tip 1: Mention only what is required for your profile. For example, do not stress too much about your co-curricular stuff. Instead, try explaining more of your technical stuff that is relevant to your job.
Tip 2: Keep it limited to 1 page. Make sure it's a PDF and not an image.



Use zero-based indexing for the vertices.
The given graph doesn’t contain any self-loops.
I used Kosaraju’s algorithm to find the strongly connected components (SCCs) in the directed graph.




Can you solve the problem in O(N) time?
I solved this problem using a greedy approach.



1. A binary tree is a tree in which each node has at most two children.
2. The given tree will be non-empty.
3. The given tree can have multiple nodes with the same value.
4. If there are no nodes in the tree which are at distance = K from the given node, return an empty list.
5. You can return the list of values of valid nodes in any order. For example if the valid nodes have values 1,2,3, then you can return {1,2,3} or {3,1,2} etc.

Consider this tree above. The target node is 5 and K = 3. The nodes at distance 1 from node 5 are {2}, nodes at distance 2 from node 5 are {1, 4} and nodes at distance 3 from node 5 are {6, 3}.




Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?