Search Results

Searching for: nested loops

Individual Exercises

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 str and an int n, return a string made of the first n characters of the string, followed by the first n - 1 characters of...

0 / 50

Return an array that contains the exact same numbers as the given array, but rearranged so that all the even numbers come before all the...

0 / 50

Given n >= 0, create an array with the pattern {1, 1, 2, 1, 2, 3, ... 1, 2, 3 .. n} (spaces added to show the grouping). Note that...

0 / 30

Given a string of any length, return a new string where the last 2 chars, if present, are swapped, so "coding" yields "codign".

0 / 50

Return true if somewhere in the array, there are three increasing adjacent numbers like .... 4, 5, 6, ... or 23, 24, 25.

0 / 50

Given start and end integers, return a new array containing the sequence of integers from start up to but not including end, so start = 5...