Given an array of int
s, return true
if every 2 that appears in the array is next to another 2. Otherwise, return false
.
Search Results
Individual Exercises
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...
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...
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....
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...
Write a function in Java that implements the following logic: Return a version of the given array where each zero value in the array is...
Given a non-empty array of type int
, return a new array containing the elements from the original array that came before thefirst 4 in...
Given an array of int
values, return true if the group of n
numbers at the start of the array is the same as the group of n
numbers at...
Say that a "clump" in an array is a series of 2 or more adjacent elements of the same value. Return the number of clumps in the given...
Given an array, return an array that contains exactly the same numbers as the original array, but rearranged so that every 4 is...
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...
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...
Given a string of any length, return a new string where the last 2 chars, if present, are swapped, so "coding" yields "codign".
Return true
if somewhere in the array, there are three increasing adjacent numbers like .... 4, 5, 6, ... or 23, 24, 25.
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...
Return an array that is "left shifted" by one--so for an input of {6, 2, 5, 3}, the method returns {2, 5, 3, 6}. You may modify and...
Given a non-empty array of int
s, return a new array containing the elements from the original array that come after the last 4 in the...
We'll say that an element in an array is "alone" if there are values before and after it, and those values are different from it. Return...
Return an array that contains the exact same numbers as the given array, but rearranged so that all the zeros are grouped at the start of...
Given two arrays of int
s sorted in increasing order, called outer
and inner
, return true
if all of the numbers in inner
also appear in ...
Given n
>= 0, create an array of length n * n
with the following pattern, shown here for n
= 3 : {0, 0, 1, 0, 2, 1, 3, 2, 1} (spaces...
Given an array of int
s, compute recursively the number of times that the value 11 appears in the array (no loops). We'll use the...
Given an array of int
s, compute recursively if the array contains somewhere a value followed immediately by that same value times 10....
Given an array of int
s, compute recursively if the array contains a 6. We'll use the convention of considering only the part of the array...
Given an array of integers, return the sum of all values in the array.