I started with run-length encoding on each row of '#' and ' ' characters, which felt obvious, but then they pushed on packing bits into bytes and I fumbled around for a bit.
Start by clarifying the bitmap format and constraints, then design a compression scheme that exploits spatial redundancy (e.g., run-length encoding per row) and implement compress/decompress with clear APIs. Finally, render a character by decompressing its glyph and mapping pixels to output, and analyze compression ratio and trade-offs between encoding and rendering costs.
Pro tip: Quantify the trade-off: for example, RLE can achieve 10-20x compression on typical fonts, but decompression adds CPU cost; consider caching decompressed glyphs to amortize rendering cost.
Ask about bitmap dimensions, character set size, expected compression ratio, and whether compression is lossless. Confirm if rendering is to a screen or buffer.
Choose a simple yet effective method like run-length encoding (RLE) per row, or bit-packing for sparse bitmaps. Explain why it suits 2D pixel grids.
Write functions that take a table (map of char to 2D array) and return compressed data, and vice versa. Ensure decompress(compress(table)) == table.
Given a character, decompress its glyph (or use cached version) and output it as a 2D grid or string. Discuss handling missing characters.
Estimate compression ratio based on bitmap sparsity. Discuss encoding cost (time to compress) vs rendering cost (time to decompress and draw), and when to cache.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.