Approach Explanation o( ̄▽ ̄)ブ
- The array is sorted, but negatives become positive when squared.
- The largest square will come from either the leftmost negative or the rightmost positive.
- I used two pointers (left and right) to compare absolute values.
- I placed the larger square at the end of the result array and moved the pointer inward.
- I repeated until the result array was filled in sorted order.
Method Used: (/^▽^)/
- Two-pointer technique
- Fill from the back
- In-place logic with extra result array
- Single traversal
- Constant pointer space

Top comments (0)