Given a sorted array, reorder the elements by the sorted order of their squares.
Unlock detailed company stats for this questionUpgrade
Input: [-3, -2, -1, 0, 1, 2, 3, 4]. Output: [0, -1, 1, -2, 2, -3, 3, 4].
Expect follow-ups like
- Return the k-th element of the square-sorted order, then optimize it.
Community answers
No answers contributed by the community yet.
Related questions
Return the k-th element of the square-sorted order.Given M sorted arrays with N total elements, find the Kth element in sorted order.Squares of sorted arrayRelated courses

Course

Course
Course
