public class CodeCamp extends Object
|Modifier and Type||Method and Description|
Given a 2D array of ints return the value of the most valuable contiguous sub rectangle in the 2D array.
Determine the Hamming distance between two arrays of ints.
Determine if one array of ints is a permutation of another.
Determine the index of the String that has the largest number of vowels.
Determine if the chess board represented by board is a safe set up.
Perform an experiment simulating the birthday problem.
public static int hammingDistance(int aList, int bList)
aList- != null, aList.length == bList.length
bList- != null, bList.length == aList.length
public static boolean isPermutation(int listA, int listB)
listA- != null
listB- != null
public static int mostVowels(String list)
pre: list != null, list.length > 0, there is an least 1 non null element in list
post: return the index of the non-null element in list that has the
largest number of characters that are vowels.
If there is a tie return the index closest to zero.
The empty String, "", has zero vowels.
It is possible for the maximum number of vowels to be 0.
list- the array to check
public static int sharedBirthdays(int numPeople, int numDaysInYear)
numPeople- The number of people in the experiment. This value must be > 0
numDaysInYear- The number of days in the year for this experiement. This value must be > 0
public static boolean queensAreSafe(char board)
pre: board != null, board.length > 0, board is a square matrix.
(In other words all rows in board have board.length columns.),
all elements of board == 'q' or '.'. 'q's represent queens, '.'s
represent open spaces.
post: return true if the configuration of board is safe,
that is no queen can attack any other queen on the board.
the parameter board is not altered as a result of
board- the chessboard
public static int getValueOfMostValuablePlot(int city)
pre: mat != null, mat.length > 0, mat.length > 0, mat is a rectangular matrix.
post: return the value of the most valuable contigous sub rectangle
city- The 2D array of ints representing the value of each block in a portion of a city.