Tip 1 : Practice ds and algo
Tip 2 : Be confident
Tip 3 : Speak out loud and Be clear
Tip 1 : Mention only what you know
Tip 2 : Having Cp ranks is a plus
The idea is to remove a row or column in each comparison until an element is found. Start searching from the top-right corner of the matrix.
Insert a new node after every node with same value
Make a copy
Separate the two lists
If we make sure that all even positioned (at index 0, 2, 4, ..) elements are greater than their adjacent odd elements, we don’t need to worry about odd positioned element.
I used the properties of preorder
I used Recursion
I used HashMap for optimization
Create a graph
Traverse the two strings at a time, for forming an edge
Finally do Topological Sort