Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 464 Bytes

double23.md

File metadata and controls

21 lines (15 loc) · 464 Bytes

double23

Given an int array, return true if the array contains 2 twice, or 3 twice. The array will be length 0, 1, or 2.

double23([2, 2]) → true
double23([3, 3]) → true
double23([2, 3]) → false

Solution:

public boolean double23(int[] nums) {
  return nums.length == 2 && ((nums[0] == 2 && nums[1] == 2) || (nums[0] == 3 && nums[1] == 3));
}

codingbat

< back to readme