Iterate through the given array and return the number of fours.
Search Results
Individual Exercises
Write a function in Java that takes in the int[] array
, sorts it using bubble sort, then returns back the sorted array.
May Tricks owns a chain of magic shops. She hands you a list of her store locations and asks you to find a way of quickly looking up the...
What would be the Big O Complexity for the following method?
public boolean crossRoad(boolean isSafe, int height, int length) { if...
Given is an adjacency matrix and a starting index.
Complete the depth first traversal method. Comments noted with //_________________ are...
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...
Design a class Dog, making sure it is appropriately encapsulated. The class will have the properties 'name' and 'breed' (both Strings), a...
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...
Complete the method so that the number num
is set to index point index
in the array named array
. Be sure to handle the exception with the...
Surround the appropriate lines of code with a try catch block so that first, an exception is caught when the String index is out of...
Create a method that returns the third character from the String word
. Be sure to use a try catch block and use the appropriate exception...
Considering the following lines of code, what will be the output?
try { String str = null; System.out.println(str.charAt(0)); }...
Which of the following JUnit tests will fail?
In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, characterized by the fact that every number...
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.
The following method takes an integer array as a parameter. Write code that loops through the array to find the value 1. If 1 is found,...
Return the index of the last occurrence of a given number in an array. Return -1 if the number is not in the array.
The following method is a Selection Sort method. Within the method, there is an error on one line. You job is to find that line and fix...
You have been handed a mysterious piece of data by an unknown person. Judging by his shifty eyes and maniacal laughter you don't think he...