FullStory interview question

Square an array of sorted numbers

Interview Answer

Anonymous

10 Mar 2020

array.map(currentNumber => currentNumber*currentNumber) when negatives are involved: split negatives to their own array and then do a merge sort at the end [-1,-2,-3,3,5] -> [1,4,9] [9,25] <- merge sort