Skip to content

Commit

Permalink
Time: 88 ms (48.41%) | Memory: 57.2 MB (5.62%) - LeetSync
Browse files Browse the repository at this point in the history
  • Loading branch information
ShatilKhan committed Mar 2, 2024
1 parent b8f8ad8 commit 1cca3ea
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 1019-squares-of-a-sorted-array/squares-of-a-sorted-array.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @param {number[]} nums
* @return {number[]}
*/
var sortedSquares = function(nums) {
for (let i = 0; i < nums.length; i++) {
nums[i] = nums[i] * nums[i];
}
nums.sort((a, b) => a - b);
return nums;
};

0 comments on commit 1cca3ea

Please sign in to comment.