TikTok·Software Engineer·Onsite - Coding / Algorithms
- Given an array of words and a max line width, format the words into fully justified text where each line is exactly that width. Spaces should be distributed as evenly as possible, with extra spaces going to the leftmost gaps. The last line is left-justified.
- Given a string of '(', ')', and '*' characters where '*' can represent either parenthesis or an empty string, determine if there's some assignment of the wildcards that produces a valid balanced sequence. Optionally return one valid assignment.
- In a 2D grid of open cells and obstacles, find the shortest path between two given coordinates using only up/down/left/right movement. Return the path as a list of coordinates, or an empty list if none exists. Also handle out-of-bounds or blocked start/end cells.
“This one bit me.”