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.
Your idea didn't work. I did the same like firstly sorted the array, then placed element at n/2(middle element) in set1 and then alternately in set2 and set1 from both sides of middle but only a few test cases could pass!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Fair Cut
You are viewing a single comment's thread. Return to all comments →
Your idea didn't work. I did the same like firstly sorted the array, then placed element at n/2(middle element) in set1 and then alternately in set2 and set1 from both sides of middle but only a few test cases could pass!