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.
what rubbish! Why should I solve in O(NlogN). just use a Hashtable and just check that of(a[i]+k) and (a[i]-k) is in that table or not. just using one scan you can solve it. the time complexity is O(N)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Pairs
You are viewing a single comment's thread. Return to all comments →
what rubbish! Why should I solve in O(NlogN). just use a Hashtable and just check that of(a[i]+k) and (a[i]-k) is in that table or not. just using one scan you can solve it. the time complexity is O(N)