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.
@vidushig2
your algorithm's time complexity in n^2 while it can be done in nlogn. Besides "int" is not large enough to hold 10^6 . Use long long int to be on safe side.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Pairs
You are viewing a single comment's thread. Return to all comments →
@vidushig2 your algorithm's time complexity in n^2 while it can be done in nlogn. Besides "int" is not large enough to hold 10^6 . Use long long int to be on safe side.