Round 1
Questions:
You’re given a string which may contain "bad pairs".
A bad pair is defined as a pair of adjacent characters, where they are the same letter in different cases. For example, "xX" is a bad pair, but "xx" or "XX" are not.
Implement a solution to remove the bad pairs from the string.
Sample:
- Input: abxXw
- Output: abw
Additional Case:
If the input string is empty: - Input: ""
- Output: ""
Candidate's Approach
I used a stack to solve the question.
Interviewer's Feedback
No feedback provided.
Follow-up Questions
- Can you write some unit test cases for your solution? Think of it as if you are designing a feature. What unit test cases will I consider?
- How will I solve it without using stack and give me a dry test run? My response: I used a 2 pointers approach and gave him some dry test run.