Solve several coding interview problems
Company: Google
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
The interview included the following coding problems:
1. **Decode ambiguous Morse text**: Use the standard Morse mapping for letters `A-Z`. You are given a string `s` containing only `.` and `-`, with no separators between letters. Return all possible uppercase strings whose Morse encodings concatenate to exactly `s`. First describe a backtracking solution, then explain how to optimize it.
2. **Subtract large integers stored as strings**: Given two non-negative integers `a` and `b` represented as decimal strings, compute `a - b` without converting the inputs to built-in integer types. Return the normalized decimal string result, using a leading `-` if the result is negative and removing unnecessary leading zeros.
3. **Check whether two family chains intersect**: Each person has at most one `parent` pointer, so repeatedly following parent pointers forms a chain of ancestors. Given two people, determine whether their ancestor chains intersect, meaning the two people share at least one common ancestor node.
4. **Find the maximum overlap among squares**: You are given a set of axis-aligned squares in 2D. Each square is represented by its bottom-left corner `(x, y)` and side length `len`. Determine the maximum number of squares that cover the same point on the plane. Assume boundary points count as covered. A verbal algorithmic explanation is sufficient; full code is not required.
Quick Answer: This set of problems evaluates proficiency in string processing and combinatorial parsing, arbitrary-precision arithmetic using string representations, pointer/ancestor-chain intersection detection, and computational geometry for overlap counting, emphasizing algorithmic design, correctness, and performance.