Write a function in Java that implements the following logic: Given a string and an int n
, return a string made of n
repetitions of the...
Search Results
Individual Exercises
Given a string str
, find all places where a three-letter combination starting with "z" and ending with "p" occurs. Return a string where...
Write a function in Java that implements the following logic: Given a string str
and a non-empty word
, return a string made of each...
Write a function in Java that counts the number of times the string "code" appears anywhere in the given string str
, except that we'll...
Write a function in Java that returns true if the given string str
contains an occurrence of the substring "xyz" where "xyz" is not...
We'll say that a string is xy-balanced if for all the 'x' characterss in the string, there exists a 'y' character somewhere later in the...
A sandwich is two pieces of bread with something in between. Write a Java method that takes in a string str
and returns the string that...
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?
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?
What is the average time complexity for inserting an element into a binary search tree?
What would be the Big O Complexity for a Bubble Sort method?
The circuit()
method is intended to take the distance a person has moved on a circuit (a track) and translate it into the position they...
What would be the Big O Complexity for the following method?
public boolean crossRoad(boolean isSafe, int height, int length) { if...
When a method is directly recursive, what does it call?
Which operation has a different Big O complexity from the others?
If the class Pug
extends the class Dog
, what can't be said about the classes?
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...