Solve Four Interview Coding Problems
Company: Pinterest
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
The interview included four coding problems of the following form:
1. Given a list of airline tickets represented as `[from, to]`, use every ticket exactly once to build a valid itinerary that starts from a fixed airport such as `JFK`. If multiple valid itineraries exist, return the lexicographically smallest one.
2. Given a list of log records, each with a date-string timestamp, sort the logs by time and then use binary search to return the index of a target timestamp, or the insertion position if the target does not exist.
3. Given a 2D grid representing a lighthouse puzzle, simulate how a light ray travels through the grid. The ray may pass through empty cells, stop at blockers, and change direction at reflection cells. Return the illuminated path or the final stopping state.
4. Design a data structure for an escape-room style game in which players move only forward through rooms. Support player advancement in `O(1)`, querying a player's current room in `O(1)`, and generating a leaderboard in `O(N + k)`, ordered by farthest position reached, with ties broken by the order in which players entered their current room.
Quick Answer: This question set evaluates algorithmic problem-solving skills including graph traversal and itinerary reconstruction, time-sorted search and binary search, grid-based simulation of ray traversal, and data structure design for efficient updates and leaderboard generation.