Databricks·Software Engineer·Technical Phone Screen
- Design and implement a streaming integer codec that supports two encoding strategies: run-length encoding for repeated values and bit-packed encoding for variable values. The encoder receives values one at a time and must decide per block which strategy to use.
- Define the exact in-memory structure for both RLE and bit-packed blocks, including how the bit-packed payload is stored and how bit-width is determined per block.
- Implement the Decoder as an iterator that reconstructs the original integer sequence from a list of encoded blocks, handling both RLE and bit-packed block types correctly.
- Write unit tests covering: sequences with no repeats, long single-value runs, alternating RLE and bit-packed patterns, edge values like Integer.MAX_VALUE and Integer.MIN_VALUE, and the empty input case.
“This one took me a minute to even parse.”