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.
I think you mis-understood how this piece of the code works
for(inti=0,j=0;i<n;i++)for(;j<m;j++)
This is a n+m for loop iterator, notice how m is not reset after each loop of n. So I don't check every pairing but rather only the pairings that make logical sense. Also the O(n log(n)) time I state as the upper bound is where n = n+m, but I am guessing you already knew that.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Electronics Shop
You are viewing a single comment's thread. Return to all comments →
I think you mis-understood how this piece of the code works
This is a n+m for loop iterator, notice how m is not reset after each loop of n. So I don't check every pairing but rather only the pairings that make logical sense. Also the O(n log(n)) time I state as the upper bound is where n = n+m, but I am guessing you already knew that.