A seat map shows a row of seats as a string row of uppercase letters, one letter per seat class. An admin can change the class of at most k seats. A group booking wants the longest run of neighboring seats that all have the same class.
Write longestUniformRun(row, k) that returns the length of the longest run of one repeated letter that can be made by changing at most k letters.
Input: row = "ABAB", k = 2 Output: 4
Change both As to B (or both Bs to A).
Input: row = "AABABBA", k = 1 Output: 4
Change the A at index 3 to get BBBB from index 2 to 5.
0 <= row.length <= 100000row contains uppercase letters A to Z.0 <= k <= row.lengthRun tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #146 Longest Uniform Run After k Edits. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.