BitFont Part 2 - Render a Word
Updated
Problem statement
Practice sequence
A bitmap font stores one bitmap for each supported character. The lookup table is represented by two parallel inputs: characters[i] names the character whose bitmap is stored in bitmaps[i].
Render text by placing its character bitmaps side by side with no columns inserted between them. Build each output row from left to right, then replace every 0 with . and every 1 with #.
Row alignment
If text is empty, return an empty array. Otherwise, the output height is the number of rows in the first character's bitmap.
For each later character, use its row at the current output row when that row exists. If the character has fewer rows, append an all-zero row with that character's width. If it has more rows than the first character, ignore the extra bottom rows.
Function
renderWord(text: String, characters: String, bitmaps: String[][]) → String[]Examples
Example 1
text = "ABA"characters = "AB"bitmaps = [["010","101","111"],["10","11"]]return = [".#.#..#.","#.####.#","###..###"]The first A gives the output height of three rows. On the third row, B has no bitmap row, so its two-column width contributes 00. The binary row 11100111 renders as ###..###.
Example 2
text = ""characters = "A"bitmaps = [["1"]]return = []An empty text returns an empty rendered picture.
Example 3
text = "BA"characters = "AB"bitmaps = [["010","101","111"],["10","11"]]return = ["#..#.","###.#"]The first character B has two rows, so only two output rows are produced. The third row of A is not used.
Constraints
0 <= text.length() <= 1001 <= characters.length() == bitmaps.length <= 100- Every character in
charactersis unique, and every character intextappears incharacters. - Each bitmap contains between
1and100rows. - Every row in one bitmap has the same length, between
1and100. - Every bitmap row contains only
0and1. - Different characters may use different bitmap heights and widths.
More Stripe Onsite Interview questions
- Parse Boolean Rule ExpressionsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Invoice / Payment ReconciliationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Render a Task Tree from CSV RowsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Transaction Rule Expression EvaluatorONSITE INTERVIEW · Seen Oct 2026
- Evaluate Ordered Action RulesPHONE SCREEN · ONSITE INTERVIEW · Seen Sep 2026
- WebSocket Load Balancer — Parts 1–5OA · ONSITE INTERVIEW · Seen Sep 2026
- Rule-Driven Transaction Fraud DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
- Account Balance Manager Part 3 - Platform CoverageONSITE INTERVIEW · Seen May 2026
- Account Balance Manager Part 2 - Reject OverdraftsONSITE INTERVIEW · Seen May 2026
- Account Balance Manager Part 1 - Calculate TotalsONSITE INTERVIEW · Seen May 2026
Similar questions at other companies
- Hidden ArtifactsIMC Trading · OAIMC Trading interview questions
- Route Pattern MatcherGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
- Query Log MatchDatadog · PHONE SCREEN · ONSITE INTERVIEWDatadog interview questions
- File System Shell CommandsHarvey · ONSITE INTERVIEWHarvey interview questions
- Feature Flags with Rules, Dependencies and ExposurePerplexity AI · ONSITE INTERVIEWPerplexity AI interview questions
- Rectangle Point Coverage CountsOpenAI · PHONE SCREEN · ONSITE INTERVIEWOpenAI interview questions
- Generate Word Guess FeedbackAtlassian · ONSITE INTERVIEWAtlassian interview questions
- Stable Unique Column RenamesMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Cyclic Fuel Command SimulationWaymo · ONSITE INTERVIEWWaymo interview questions
- Most Frequent Call Path in Interleaved LogsRoblox · ONSITE INTERVIEWRoblox interview questions