Algorithm · Walmart Labs · Easy
You receive an array of characters and access to a predicate isCorrupted(char c), which reports whether a given character has been corrupted. Once a corrupted character appears, every character after it is corrupted as well. Determine the earliest corrupted character as efficiently as possible. Input chars: A character array containing at most 10^6 elements. isCorrupted(char c): A method that indicates whether a character is corrupted. Output Return the character at the…