Sort squares of a sorted array in linear runtime (O(n))

Given a sorted array that contains both negative and positive integers we aim to get its squares array in sorted orders. Let us understand this with an example. Let’s understand how we can solve this problem in linear time. To solve this in linear time, we have to take two handles which represent the startRead More »

Advertisements