Level: Mid-Level
Round: Online Assessment · Type: Coding · Difficulty: 6/10 · Duration: 90 min · Interviewer: Neutral
Topics: String Manipulation, Greedy Algorithms
Location: Seattle, WA, US
Interview date: 2026-01-26
Got offer: False
I had 90 minutes for two coding problems. I solved the first one partially, passing 13/15 test cases. I couldn't solve the second one.
The first problem involved a string containing 0, 1, and ! characters. A ! appears when a '10' or '01' subsequence pair is present in the string. Given an error string like '101!1', I needed to calculate the total number of errors. The approach involved replacing the ! with either 1 or 0 to maximize the number of '10' and '01' pairs and then calculating (n01 * x + n10) * y % 10^9 + 7.
I initially tried a backtracking solution, but it had a time complexity of 2^n. The correct approach should be a greedy algorithm where all ! are treated as 1 or 0, and then I'd scan the string to count the number of '01' and '10' pairs.
The second problem gave:
n: number of city (1 indexed) population = [10, 5, 8, 9 , 6] unit = "01101"
where 'unit' represents whether a city has a security guard. A security guard can move to the left at most once. The leftmost guard cannot move further left. I needed to return the maximum population that can be protected.