package codingbat.array2;

/*
 * Given an array of ints, return true if the array contains 
 * a 2 next to a 2 somewhere. 
 * 
 * has22({1, 2, 2}) = true
 * has22({1, 2, 1, 2}) = false
 * has22({2, 1, 2}) = false
 * 
 */

public class Has22Test {

  public static void main(String[] args) {
    Has22Test test = new Has22Test();

    System.out.println(">" + test.has22(new int[] {1, 2, 2}) + "<");
    System.out.println(">" + test.has22(new int[] {1, 2, 1, 2}) + "<");
    System.out.println(">" + test.has22(new int[] {2, 1, 2}) + "<");
  }

  public boolean has22(int[] nums) {
    return false;
  }

}

@@ -583,20 +583,194 @@
     
-return false
+boolean has22 = false;    %0A    %0A    for (int i = 0; i %3C nums.length-1; i++) %7B%0A      %0A      if (nums%5Bi%5D == 2 && nums%5Bi+1%5D == 2) %7B%0A        has22 = true;%0A      %7D%0A    %7D%0A    %0A    return has22
 ;%0A  

complete task has22