Sponsored
Solve with full IDE support and test cases
Use these hints if you're stuck. Try solving on your own first.
Divide the array into two arrays by keeping track of the last elements of both subarrays.