Meta·Software Engineer·Technical Phone Screen
- Given an array of integers in [0, 255] representing bytes, determine whether the sequence encodes valid characters under a variable-length encoding scheme. Single-byte characters start with bit 0, multi-byte characters use a specific prefix pattern for the first byte and 10xxxxxx for continuation bytes, and the sequence must not end mid-character. Return true or false and explain your time and space complexity.
- Given an n×n binary grid where 0 means open and 1 means blocked, find the shortest path from the top-left to the bottom-right cell using 8-directional movement. Count both the start and end cells in the path length, and return -1 if no path exists. Discuss your algorithm and its complexity.
“This one looked like a bit manipulation problem but it's really just careful state tracking.”