Given an array containing three ints, return the sum of all the elements. It is safe to assume that the array always has at least 3...
Drill & Practice: Arrays (Java Review)
Score: 0 / 30.0
Exercises
Given two int arrays a and b, each with two elements, return a new array with four elements containing all the elements of a followed by...
Given an int array of any length, return a new array of its first 2 elements. If the array is smaller than length 2, use whatever...
Given an int array nums of any length, return a new array of its first n elements. If the array is smaller than length n, use whatever...
Write a function in Java that takes an int array as its parameter and returns the number of even ints it contains. Note: the % "mod"...
We'll say that a value is "everywhere" in an array if for every pair of adjacent elements in the array, at least one of the pair is that...
Given an int[] array, write a function that returns an array where all the 10's have been removed. The remaining elements should shift...
For each multiple of 10 in the given array, change all the values following it to be that multiple of 10, until encountering another...
Given an array of ints, return true if every element is either a 1 or a 4. Otherwise, return false.
Return the sum of all fours in a given array.
Iterate through the given array and return the number of fours.
Return the index of the first four in an array. Return -1 if there are none.
Description
Complete the function countNegatives() so that it counts of negative values in the array numbers. You may assume that the...
Complete the function countStrLongerThan() so that it returns the count of Strings in the array names that are longer than minLen. You...
Complete the function countStrings() so that it returns the count of Strings in the array names that are not null.
Complete the function countStrLongerThan() so that it returns the count of Strings in the array names that are longer than minLen. You...
Given an array of integers, return the largest value in the array. Assume the array has only posivitive numbers. If the array is empty,...
Given an array of ints, return the smallest value in the array. Assume the array has only posivitive numbers. If the array has no values...
Given an array of Strings, return the longest String in the array. If the array is empty, return null.
Given an array of integers, return the sum of all the values in the array.
Given an array of integers, return the first element in the array that is larger than maxVal. Assume the array has only posivitive...
The following method takes in an array of integers called numbers. Implement the method so that it increases the value of each item in...
Given an array of ints, return the POSITION (i.e., the index) of smallest value in the array. Assume the array has only posivitive...
A local grocery store has asked you to design a method to verify if their produce is okay to put on the shelves. The method takes an...
Given an array of ints, return true if all values in the array are even values. This routine should return false if at least one value is...
Write a method repeated that returns true if the parameter lookFor appears more than one time in the array elements. It should return...
Write a method unique that returns true if the parameter lookFor appears only one time (i.e., it is unique) in the array elements. It...
Write a method missing that returns true if the parameter lookFor is missing in the array elements. It should return false if lookFor...
Write a method duplicate that returns true if the parameter lookFor appears exactly 2 times in the array elements. It should return false...
Description
Write a method allSame that returns true if all of the array's elements are the same, false otherwise. Note that you don't...