Leetcode 3069. Distribute Elements Into Two Arrays I
Simulate a greedy sequential distribution: put nums[0] in arr1 and nums[1] in arr2, then for each subsequent nums[i] append it to arr1 if the last element of arr1 > last of arr2, otherwise to arr2; return arr1 concatenated with arr2. This is a straightforward O(n) simulation on distinct integers.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.