Question: 7. Max Bunch Count A bunch in an array is a consecutive chain of two or more adjacent elements of the same value. Write

7. Max Bunch Count A "bunch" in an array is a consecutive chain of two or more adjacent elements of the same value. Write a method that returns the number of elements in the largest bunch found in the given array. Input: [1, 2, 2, 3, 4, 4, 4] Output: 3 Explanation: There are two bunches here {2,2} and {4,4,4}. The largest bunch is {4,4,4} containing 3 elements so 3 is returned. Input: [1,1,2, 2, 1, 1,1,1] Output:4 Explanation: There are three bunches here {1,1} and {2,2} and {1,1,1,1}. The largest bunch is {1,1,1,1} containing 4 elements so 4 is returned.
Step by Step Solution
3.39 Rating (146 Votes )
There are 3 Steps involved in it
check out the solution CODE public cl... View full answer
Get step-by-step solutions from verified subject matter experts
