File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*Copyright (c) Jul 2, 2015 CareerMonk Publications and others.
2
+ * E-Mail : info@careermonk.com
3
+ * Creation Date : 2015-01-10 06:15:46
4
+ * Last modification : 2006-05-31
5
+ by : Narasimha Karumanchi
6
+ * File Name : ConvertArraytoSawToothWave.java
7
+ * Book Title : Data Structures And Algorithms Made In Java
8
+ * Warranty : This software is provided "as is" without any
9
+ * warranty; without even the implied warranty of
10
+ * merchantability or fitness for a particular purpose.
11
+ *
12
+ */
13
+
14
+ package chapter10sorting ;
15
+
16
+ class SortedSquaredArray {
17
+ public int [] sortedSquaredArray (int [] A ) {
18
+ int n = A .length ;
19
+ int [] result = new int [n ];
20
+ for (int i = 0 ; i < n ; ++i )
21
+ result [i ] = A [i ] * A [i ];
22
+
23
+ Arrays .sort (result );
24
+ return result ;
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments