EPI v1.5.3 Problem 6.7 Variant

#1

“Write a program that takes an array of integers and finds the length of a longest subarray all of whose entries are equal.”

Are the subarrays contiguous?

0 Likes

EPIJ (2017 ed) - 5.6 variant 1- Find length of longest subarray with equal entries
#2

Yes, the definition of subarray is contiguous. In general, the definition of array is a set of contiguous elements.

0 Likes

#3

E.g., for A = [3,2,5,5,3,2,2,2,3,7,7,7,7,7,6,7,3,3,3,3] the longest subarray all of array entries are equal is A[9:13], i.e., the subarray of five 7s.

0 Likes