posted 15 years ago
Could anyone provide any assistance on the following two assignments. Your help would be appreciated.
# 1
Given an int array length 2, return true if it contains a 2 or a 3.
has23({2, 5}) → true
has23({4, 3}) → true
has23({4, 5}) → false
#2
Return the number of even ints in the given array. Note: the % "mod" operator computes the remainder, e.g. 5 % 2 is 1.
countEvens({2, 1, 2, 3, 4}) → 3
countEvens({2, 2, 2}) → 3
countEvens({1, 3, 5}) → 0