beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Array Is All Larger

Geoffrey Challen // 2022.2.0

Write a method arrayIsAllLarger that, given two int arrays, returns true if all the values in the first array are larger than or equal to all the values in the same position in the second array. If the first array is longer than the second array, or the second array is longer than the first array, then the extra values can be ignored. If either array is empty, return false.

For example, given {1, 2, 4} and {0, 1, 7}, you should return false, since 7 is greater than 4. Given {1, 2, 4} and {0, 1} you should return true, since the first two values of the first array are greater than the first two values of the second array. Given {1, 2, 4} and {0, 1, 3, 8}, you should return true, since the first three values of the first array are greater than the first three values of the second array. Given {1, 2} and {1, 2}, you should return true, since all values in the two arrays are equal.