mpierse 8 лет назад
Родитель
Сommit
945da3fc56
1 измененных файлов: 11 добавлений и 10 удалений
  1. 11
    10
      src/main/java/com/zipcodewilmington/StringArrayUtils.java

+ 11
- 10
src/main/java/com/zipcodewilmington/StringArrayUtils.java Просмотреть файл

63
      * @return an array with identical contents in reverse order
63
      * @return an array with identical contents in reverse order
64
      */ // TODO
64
      */ // TODO
65
     public static String[] reverse(String[] array) {
65
     public static String[] reverse(String[] array) {
66
-        int num = array.length;
67
-        String[] revArr;
68
-        revArr = String[num];
69
-        int cnt2= num-1;
70
-        for (int cnt1 =0; cnt1<num; cnt1++) {
71
-            array[cnt1]=revArr[cnt2];
72
-            cnt2--;
66
+        for (int i=0; i<array.length/2; i++){
67
+            String tmp = array[i];
68
+            array[i]=array[array.length-i-1];
69
+            array[array.length-i-1]=tmp;
73
         }
70
         }
74
-        return revArr;
71
+        return array;
75
     }
72
     }
76
 
73
 
77
     /**
74
     /**
79
      * @return true if the order of the array is the same backwards and forwards
76
      * @return true if the order of the array is the same backwards and forwards
80
      */ // TODO
77
      */ // TODO
81
     public static boolean isPalindromic(String[] array) {
78
     public static boolean isPalindromic(String[] array) {
82
-        return false;
79
+
80
+        return Arrays.equals(reverse(array), array);
83
     }
81
     }
84
 
82
 
85
     /**
83
     /**
87
      * @return true if each letter in the alphabet has been used in the array
85
      * @return true if each letter in the alphabet has been used in the array
88
      */ // TODO
86
      */ // TODO
89
     public static boolean isPangramic(String[] array) {
87
     public static boolean isPangramic(String[] array) {
90
-        return false;
88
+        boolean[] letterPresent = boolean[26];
89
+        if (){
90
+
91
+        }
91
     }
92
     }
92
 
93
 
93
     /**
94
     /**