Given an array of integers, return the sum of every other value in the array, starting with the first element. For example, if the array...
Search Results
Searching for: array
Individual Exercises
Given an array of integers, return the average of all values in the array as a double
. For example, if an array containing the values...
Given two integers size
and num
, return an array that can hold size
integers and is filled with multiples of num
, starting with num
. For...
Given an array of String
s, return a single String
that is made up of all strings in the array concatenated together in order. For...
Given an array of String
s, return a single String
that is made up of all strings in the array concatenated together in reverse order. For...
Given an array of integers and an integer target
, return a count of the number of times the target
value occurs in the array.
Given an array of integers, return the largest value that occurs in the array. You may want to use the constant Integer.MIN_VALUE
, which...
Given an array of integers, return the smallest value that occurs in the array. You may want to use the constant Integer.MAX_VALUE
, which...
Given an array of double
values that contains the prices of merchandise, return the range of the prices (the difference between the...
Given an array of integers, swap each pair of adjacent elements starting with the first two. For example, if the array contains the...
Given a String
, return an array of char
values that contains the characters of the string in reverse order. For example, if the string is...
Given two strings of equal length, return an array of char
values that contains the characters of the strings in alternating order. For...
You have created an adjacency matrix with enough space to store the distances between May Tricks' magic shops. Now it is time to enter...
The following method takes an integer array as a paramter. Write code that loops through the array to find the value 1. If 1 is found,...
In the following code, which line will produce an error?
public class Answer { int[] nums = new int[5]; // Line 1 nums[0] = 1000000; //...
What is the complexity of searching an ArrayList?
Which of the following is a correct instantiation of an array list collection?
The local library needs help keeping track of overdue books. Currently, the library has a record of each book checked out but wishes to...
Write a method that reverses the contents of any given string array, then return the reversed conents as an arraylist. If the given array...
The Student Chapter for the Association for Computing Machinery (ACM) requested your help. Throughout the semester, attendance for the...
What interface does the Array list implement?
Do array lists automatically enlarge (or shrink) based on the size of the collection?
What is most important to know when attempting to retrieve an element from an array list?
When the index is known, what is the time complexity for accessing an element in an array list?
Given is an adjacency matrix and a starting index.
Complete the breadth first traversal method. Comments noted with //_________________...