Comments

Thanks for your reply. The only problem i face with your code is that it limits me to add values in the range [0,n) . I had the constraints for n<=1e5 and for arr[i]<=1e9. So do you have any other template for this? Basically i want to use this in this leetcode problem : https://leetcode.com/contest/weekly-contest-387/problems/distribute-elements-into-two-arrays-ii/