I am getting WA in problem DST.
My approach for the problem is :
- Sort all edges for each node.
- Starting from root run a DFS.
- Check if DFS traversal has required pattern as subsequence.
- Whenever required pattern is found stop.
- Find route from root to the node and continue up to a leaf node by traversing in similar fashion.
Here is link to my Code. Can anyone tell if my approach is wrong or the implementation?
Any test case where my solution fails will be helpful.
Thanks in advance 