package com.fishercoder.solutions;

import java.util.Arrays;

/**
 * 977. Squares of a Sorted Array
 *
 * Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order.
 *
 * Example 1:
 * Input: [-4,-1,0,3,10]
 * Output: [0,1,9,16,100]
 *
 * Example 2:
 * Input: [-7,-3,2,3,11]
 * Output: [4,9,9,49,121]
 *
 *
 * Note:
 * 1 <= A.length <= 10000
 * -10000 <= A[i] <= 10000
 * A is sorted in non-decreasing order.
 */
public class _977 {
  public static class Solution1 {
    public int[] sortedSquares(int[] A) {
      int[] result = new int[A.length];
      for (int i = 0; i < A.length; i++) {
        result[i] = (int) Math.pow(A[i], 2);
      }
      Arrays.sort(result);
      return result;
    }
  }
}

@@ -59,445 +59,8 @@
 s;%0A%0A
-/**%0A * 977. Squares of a Sorted Array%0A *%0A * Given an array of integers A sorted in non-decreasing order, return an array of the squares of each number, also in sorted non-decreasing order.%0A *%0A * Example 1:%0A * Input: %5B-4,-1,0,3,10%5D%0A * Output: %5B0,1,9,16,100%5D%0A *%0A * Example 2:%0A * Input: %5B-7,-3,2,3,11%5D%0A * Output: %5B4,9,9,49,121%5D%0A *%0A *%0A * Note:%0A * 1 %3C= A.length %3C= 10000%0A * -10000 %3C= A%5Bi%5D %3C= 10000%0A * A is sorted in non-decreasing order.%0A */%0A
 publ
@@ -75,16 +75,18 @@
  _977 %7B%0A
+  
   public
@@ -111,24 +111,28 @@
 tion1 %7B%0A    
+   
+ 
 public int%5B%5D
@@ -153,24 +153,30 @@
 (int%5B%5D A) %7B%0A
+      
       int%5B%5D 
@@ -209,16 +209,22 @@
 ;%0A      
+ 
+     
 for (int
@@ -260,16 +260,24 @@
         
+  
+      
 result%5Bi
@@ -315,16 +315,28 @@
     
-%7D%0A
+      %7D%0A   
       
+   
 Arra
@@ -358,16 +358,22 @@
 ;%0A      
+     
+ 
 return r
@@ -383,16 +383,22 @@
 lt;%0A    
-%7D%0A
+    %7D%0A  
   %7D%0A%7D%0A

refactor 977