Make The String Great
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a string s of uppercase and lowercase English letters. Two adjacent characters form a **bad pair** when they are the same letter in opposite cases, such as "aA" or "Aa". Two equal characters in the same case (like "aa") are not a bad pair.
Repeatedly delete any bad pair until none remain, and return the resulting string. The result does not depend on the order of deletions. It may be empty.
Aim for O(n) time.
Examples
Constraints
- 1 <= s.length <= 100
- `s` contains only uppercase and lowercase English letters.
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.