Move positives to the right and negatives to the left in place, preserving relative order.
Unlock detailed company stats for this questionUpgrade
Sort positive numbers to the right and negative numbers to the left without increasing space complexity, preserving the relative order of numbers. Example input: [20, -10, 30, 40, -50, -60, 70]. A 2-queue approach needs extra space, which was not allowed; O(n^2) was acceptable given the constraints.
Format · Morgan Stanley R3.
Community answers
No answers contributed by the community yet.
Related courses

Course

Course
Course
