We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is what helped me solved the problem. Read wikipedia Topological sort -> Kahn's algorithm. It should give you an idea how to go about it and what ordering to use within priority queue.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Favorite sequence
You are viewing a single comment's thread. Return to all comments →
This is what helped me solved the problem. Read wikipedia Topological sort -> Kahn's algorithm. It should give you an idea how to go about it and what ordering to use within priority queue.