Grammarly: Remove adjacent duplicates chosen by a predicate
Problem. Start with the classic task: repeatedly remove pairs of equal adjacent characters from a string until none remain. Then generalise it: removal is decided by a function or predicate passed in, and characters can be processed in ascending or descending order.
Context. This was the third of four questions in a 50-minute senior engineer coding round, after climbing stairs and the plain adjacent-duplicates problem.
How it went. The candidate felt the interviewers stayed unsatisfied even after covering both DP approaches for the earlier question, and that the set felt generic rather than tied to the company's product.
Comments 0
No comments yet. Ask the author something, or add what happened in your own round.