Dsa
Arrays
Hard
Sorted Squares
Given a sorted array of integers, return the squares of each number sorted in non-decreasing order.
Input:
The first line contains an integer N, the size of the array.
The second line contains N space-separated integers.
Output:
Output a single line containing the squares of each number sorted in non-decreasing order.
Example:
Input:
5
-4 -1 0 3 10
Output:
0 1 9 16 100
Key concepts
arrayssortingtwo pointers
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now