Search
⌘K

Leetcode 3434. Maximum Frequency After Subarray Operation

Choose one contiguous subarray and add the same integer x to every element once to maximize how many elements equal k afterward. Algorithmically, this is equivalent to picking a source value v = k - x and finding a contiguous interval that converts the most v's into k (without turning existing k's into something else), under constraints n ≤ 1e5 and nums[i], k ≤ 50.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.