Most equal values after shifting one subarray

0
Remix

Given an array, you may once choose any contiguous subarray and add the same integer (positive or negative) to all of its elements. Return the largest number of equal values the array can then hold. For [2, 4, 6, 2, 4, 7], shifting 4, 6, 2, 4 by -2 gives three 2s.

AmazonOnline assessmentLast asked Aug 2025
No answer yet. Write the first one; the best answer gets endorsed.