Jump TradingMachine Learning Engineer · Technical ScreenCodemia practiceGreedy on string
Given a string consisting of lowercase letters, your task is to determine the maximum length of a substring that can be formed by removing at most one character such that the remaining characters are all the same. Return the length of this longest possible substring. For example, given the input "aabbaa", the output should be 5, as removing one 'b' results in "aaaa".