For function countChr()
write the missing part of the recursive call. This function should return the number of times that the letter "A"...
Search Results
Individual Exercises
For function recursiveMin
, write the missing part of the recursive call. This function should return the minimum element in an array of...
For function isReverse
, write the two missing base case conditions. Given two strings, this function returns true if the two strings are...
For function decToBinary
, write the missing parts of the recursion case. This function should return a string that stores the binary...
Spherical objects, such as cannonballs, can be stacked to form a pyramid with one cannonball at the top, sitting on top of a square...
Write a recursive function named checkPalindrome
that takes a string as input, and returns true if the string is a palindrome and false...
Write a recursive function that takes a start index, array of integers, and a target sum. Your goal is to find whether a subset of the...
Pascal's triangle is a useful recursive definition that tells us the coefficients in the expansion of the polynomial (x + a)^n. Each...
Given the name of a person and a phrase that person said, return a String
in the following format, including the quotation marks:
...
Given two integers, return true if the first number is evenly divisible by the second, and false otherwise. Return false if the second...
Given three double
values representing prices, return the smallest price. For example, if the values passed in are 19.95, 12.85, and...
Given a day number (1-7), return the day of the week ("Sunday", "Monday", etc.). If an invalid day number is provided, return "Invalid".
...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...
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 average of all values in the array as a double
. For example, if an array containing the values...
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 two strings of equal length, return an array of char
values that contains the characters of the strings in alternating order. For...
Write a function in Java that uses recursion (no loops) to check if the String str
has any char a
. Return true
if it does and false
if it...
When a method is directly recursive, what does it call?
Which operation has a different Big O complexity from the others?
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...
Design a class Dog, making sure it is appropriately encapsulated. The class will have the properties 'name' and 'breed' (both Strings), a...