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. Extra space (for example a 2-queue approach) is not allowed; O(n^2) time is acceptable given the constraints.
Example input: [20, -10, 30, 40, -50, -60, 70].
Format · Morgan Stanley R3.
Community answers
No answers contributed by the community yet.
Related courses

Course

Course
Course
