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.
Roads in HackerLand
Roads in HackerLand
Sort by
recency
|
40 Discussions
|
Please Login in order to post a comment
DSU + DFS + Binary shifting Solution (https://pastebin.com/eLhJxpHm)
Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Roads in HackerLand Solution
Here is the solution of Roads in HackerLand Click Here
The given constraint C_i < M is just... wrong.
This problem is no fun to solve without a reasonable and correct constraint on the number of distinct roads there are. If the lengths are all distinct powers of 2, then there really can't be more than 64 of them without forcing the program to use arbitrary-length integers.
Can somemone provide working c++ solution which passes all test cases.