Elliott Stansbury 6 lat temu
rodzic
commit
4155bd6f66

+ 10
- 1
src/main/java/rocks/zipcode/io/quiz3/arrays/SquareArrayAnalyzer.java Wyświetl plik

@@ -5,6 +5,15 @@ package rocks.zipcode.io.quiz3.arrays;
5 5
  */
6 6
 public class SquareArrayAnalyzer {
7 7
     public static Boolean compare(Integer[] input, Integer[] squaredValues) {
8
-        return null;
8
+
9
+        for(int i = 0; i < input.length; i++){
10
+            for (int j = 0; j < squaredValues.length; j++){
11
+                if(input[i] == Math.sqrt(squaredValues[j])){
12
+                    return true;
13
+                }
14
+            }
15
+        }
16
+
17
+        return false;
9 18
     }
10 19
 }

+ 14
- 2
src/main/java/rocks/zipcode/io/quiz3/arrays/TicTacToe.java Wyświetl plik

@@ -5,15 +5,27 @@ package rocks.zipcode.io.quiz3.arrays;
5 5
  */
6 6
 public class TicTacToe {
7 7
 
8
+    String[][] board;
9
+    String[] row;
10
+    String[] column;
11
+
8 12
     public TicTacToe(String[][] board) {
13
+        this.board = board;
9 14
     }
10 15
 
11 16
     public String[] getRow(Integer value) {
12
-        return null;
17
+
18
+       row = board[value];
19
+
20
+        return row;
13 21
     }
14 22
 
15 23
     public String[] getColumn(Integer value) {
16
-        return null;
24
+
25
+        for(int i = 0; i< row.length;i++) {
26
+            column[i] = board[0][value];
27
+        }
28
+        return column;
17 29
     }
18 30
 
19 31
     public Boolean isRowHomogenous(Integer rowIndex) {