overdrivemachines / sorted-squared-array

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Square Of Sorted Array

Create a function that accepts a non-empty array of integers sorted in ascending order. The function should return a new array of the same length, containing the squares of the original integers, also sorted in ascending order

NOTE : the output array should be of same length of input arrat

Sample Input

array = [1, 2, 3, 5, 6, 8, 9]

Sample Output

[1, 4, 9, 25, 36, 64, 81]

About


Languages

Language:Python 42.3%Language:C++ 35.4%Language:Makefile 22.2%