Implement string dedup and mirror tree traversal
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: Medium
Interview Round: Technical Screen
Quick Answer: This question evaluates string-processing and tree-traversal algorithm skills, focusing on efficient group-deletion and streaming-capable string dedup operations and a mirrored boundary traversal of binary trees, and it tests algorithmic design, complexity guarantees, and correctness/termination reasoning.
String Cleanup By Group Deletions
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ('abbbaaccz', 2)
Expected Output: 'abz'
Explanation: Cascading deletions leave z.
Input: ('deeedbbcccbdaa', 3)
Expected Output: 'aa'
Explanation: k=3 deletion variant.
Input: ('abc', 2)
Expected Output: 'abc'
Explanation: No deletions.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.
Mirror Boundary Traversal
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([1,[2,[4,None,None],[5,None,None]],[3,None,[6,None,None]]],)
Expected Output: [4, 2, 1, 3, 6]
Explanation: Left boundary bottom-up, root, then right boundary top-down.
Input: ([1,None,None],)
Expected Output: [1]
Explanation: Single root appears once.
Hints
- Clarify edge cases before coding.
- Keep the return value deterministic.