Given an integer num
, return the sum of the multiples of num
between 1 and 100. For example, if num
is 20, the returned value should be...
Exercises
Given a String str
and a character ch
, return the number of times ch
appears in str
. For example, if str
is "Hello" and ch
is 'l', the...
Given an array of integers, return the sum of all values in the array.
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...
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...
Consider the following class definition:
class Link{
Object data;
Link next;
}
Use a single assignment statement to make the variable p...
Consider the following class definition:
class Link{
Object data;
Link next;
}
Write the required statements to make the variable p refer...
Consider the following class definition:
class Link{
Object data;
Link next;
}
Write the required statements to make the variable q refer...
Consider the following class definition:
class Link { Object data; Link next; }
Write the required statements to make the variable r
...
Consider the followint class definition
public class Link{ public Object data; public Link next; }
Notably, there are no getters or...
Consider the following class definition:
class Link{
Object data;
Link next;
}
Use a single assigment to set the info of the Node...
Consider the following class definition:
public static class Link { public Link next; public Object data; }
Write a single assigment...
Consider the following class definition:
class Link{ Object data; Link next; }
Write a single assignment statement to transform the...
Consider the following class definition:
class Link{
Object data;
Link next;
}
Write a single assigment statement to transform the linked...
Consider the following class definition:
class Link{
Object data;
Link next;
}
Write a single assignment statement to remove the Node...