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 boolean has22(int[] nums)
{ ...}
maybe i could say...
for (int i = 0; i <= nums.length; i++) { int twoCounter = 0; if (nums[i].equals(2)) twoCounter++; if (nums[i + 1].equals(2)) return true; }
help me out with the rest of this.