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.
There are 2^K different sets for fishes , and total N shops . So total of N by 2^K states , you need the fastest way to reach from 0,i [where i is from [0,2^K-1]] to N,(2^K-1) state. graph is undirected one you can run dijsktra on N,(2^K-1) to all other states.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Synchronous Shopping
You are viewing a single comment's thread. Return to all comments →
There are 2^K different sets for fishes , and total N shops . So total of N by 2^K states , you need the fastest way to reach from 0,i [where i is from [0,2^K-1]] to N,(2^K-1) state. graph is undirected one you can run dijsktra on N,(2^K-1) to all other states.