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
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...
Iterate through the given array and return the number of fours.
What would be the Big O Complexity for the following method?
public boolean crossRoad(boolean isSafe, int height, int length) { if...
Write a function in Java that takes the int array arr
and returns a new array with each number being doubled. Be sure to make use of...
What would be the Big O Complexity for the following method?
public static void arrayDoubleValue(int[] nums, int[][] nums2) { for (int i...
Given an int[] nums
array, return the sum of the first five elements from the array. Note that nums
could have fewer than five elements,...
Create an enhanced for loop that iterates to each String in the array words
and returns true when there is at least one String with more...
Write a function findEvenQueue
that returns the first even number in the Queue. The function looks at the value at the front of the queue...
Return the index of first four in an array. Return -1 if there are none.
Return the index of the last occurrence of a given number in an array. Return -1 if the number is not in the array.
Roxy has written a method to count the number of people in her neighborhood, excluding children under 16 and individuals who are only...
Mars' new colony needs your help. This morning, a flurry of distress signals reached Earth, each encrypted with a secret message....
Complete the hashing algorithm for a hash table so that it functions using open addressing. Remember to store both keys and values in...
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...