Categorygithub.com/ductnn/coding-practicealgoexpertCoding-Interview-QuestionsArraysGreensorted-squared-array
package
0.0.0-20241225161807-6c2a4c2dbe8f
Repository: https://github.com/ductnn/coding-practice.git
Documentation: pkg.go.dev
# README
Sorted Squared Array
Problem
-
Difficulty: Green, Category: Arrays
Write a function that takes in a non-empty array of integers that are sorted in ascending order and returns a new array of the same length with the squares of the original integers also sorted in ascending order.
Sample Input
array = [1, 2, 3, 5, 6, 8, 9]
Sample Output
[1, 4, 9, 25, 36, 64, 81]