Exercises

0 / 70

Given a number n, create and return a new int array of length n, containing the numbers 0, 1, 2, ... n-1. The given n may be 0, in which...

0 / 70

Given a number n, create and return a new string array of length n, containing the strings "0", "1" "2" .. through n-1. N may be 0, in...

0 / 70

Given an array of ints, return true if the array does not contain any 1s or 3s. Otherwise, return false.

0 / 70

Given an array of ints, return true if the sum of all the 2's in the array is exactly 8.

0 / 70

Given an array of ints, return true if the number of 1s is greater than the number of 4s. Otherwise, return false.

0 / 70

Given an array of ints, return true if every element is either a 1 or a 4. Otherwise, return false.

0 / 70

Consider the series of numbers beginning at start and running up to but not including end, so for example start=1 and end=5 gives the...

0 / 70

Given an array of ints, if it contains no 1's return true. If it contains no 4's, return true. If it contains both, return false.

0 / 70

Given an array of ints, return true if the array contains a 2 next to a 2 or a 4 next to a 4, but not both. Otherwise, return false.

0 / 70

Given an array of ints, return true if the array contains two 7s next to each other, or there are two 7s separated by one element, such...

0 / 70

Given an array of ints, return true if there is a 1 in the array with a 2 somewhere later in the array.

0 / 70

Given an array of ints, return true if the value 3 appears in the array exactly 3 times, and no 3s are next to each other.

0 / 70

Given an array of ints, return true if every 2 that appears in the array is next to another 2. Otherwise, return false.

0 / 90

Given a non-empty array, return true if there is a place to split the array so that the sum of the numbers on one side is equal to the...

0 / 90

Consider the leftmost and righmost appearances of some value in an array. We'll say that the span is the number of elements between the...

0 / 90

Return an array that contains exactly the same numbers as the given array but re-arranged so that every 3 is immediately followed by a 4....

0 / 90

We'll say that a "mirror" section in an array is a group of contiguous elements such that somewhere in the array, the same group appears...

0 / 50

Given a string of even length, return the first half. So the string "WooHoo" yields "Woo".