FastPrepBitFont - Maximum Non-Overlapping Kerning
Problems/BitFont - Maximum Non-Overlapping Kerning

BitFont - Maximum Non-Overlapping Kerning

Stripe logoStripe● MediumINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Stripe intern onsite interview. Our version is about 65% the same as the reported follow-up: find the largest kerning between two bitmap letters with no ink overlapping, where zero is allowed. The report does not define the letters' orientation, the limit on the shift, or whether in-between placements matter. We chose a common height, origins that are not negative, a rule that only the final placement counts, and the number limits.

Two selected bitmap glyphs are supplied as leftGlyph and rightGlyph. Each glyph is a rectangular list of binary row strings. A 1 is ink and a 0 is background. Both glyphs have the same height.

Placement rules

Let L and R be the glyph widths. The left glyph starts at column 0. A kerning value k, with 0 <= k <= L, places the right glyph at column L - k. So k = 0 puts the glyphs side by side, and a larger value moves the right glyph closer.

A placement is valid when no output cell receives ink from both glyphs. Background columns and even the glyph bounding boxes may overlap. Evaluate each final placement independently: an invalid smaller value does not rule out a larger valid value. The right glyph may start at column 0, but never at a negative column.

Return the largest valid k. The placement at k = 0 always has disjoint glyph extents, so a result always exists.

Do not stop at the first collision while increasing k. For example, with leftGlyph = ["101"] and rightGlyph = ["010"], values 0, 1 and 3 are valid, while 2 collides. The answer is 3.

Function

maximumKerning(leftGlyph: String[], rightGlyph: String[]) → int

Examples

Example 1

leftGlyph = ["101"]rightGlyph = ["010"]return = 3

The left glyph has ink in its first and third cells, and the right glyph has ink only in its middle cell. The left glyph is three cells wide. Moving the right glyph back by 3 puts it at column 0, and its ink falls between the two left ink cells, so nothing collides. No larger shift is allowed, so the answer is the full width. Smaller shifts that collide would not matter anyway.

Example 2

leftGlyph = ["11","11"]rightGlyph = ["1","1"]return = 0

The left glyph is full of ink in both rows. With a shift of 0, the right glyph starts at column 2, right after the left glyph. Any larger shift would put its ink on top of left ink, so the answer is zero.

Example 3

leftGlyph = ["0010","0100"]rightGlyph = ["100","001"]return = 4

The left glyph is four cells wide. A shift of 4 puts the right glyph at column 0. In the top row, the left ink is in the third cell and the right ink is in the first. In the bottom row, they are in the second and third cells. The ink never lands on the same cell, so the largest shift is the full width.

Constraints

  • 1 <= leftGlyph.length == rightGlyph.length <= 100.
  • Every row in leftGlyph has the same width L; every row in rightGlyph has the same width R.
  • 1 <= L, R <= 100.
  • Rows contain only ASCII 0 and 1. Entirely background rows or glyphs are allowed.

More Stripe Onsite Interview questions

  • Invoice / Payment ReconciliationPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Parse Boolean Rule ExpressionsPHONE 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

  • Game of Life: In-Place Next GenerationGoogle · ONSITE INTERVIEWGoogle interview questions
  • 2048 Simulation and Board CodecCitadel · ONSITE INTERVIEWCitadel interview questions
  • Hybrid Run-Length and Bit-Packing EncoderDatabricks · ONSITE INTERVIEWDatabricks interview questions
  • Repeated Mirror XORMathWorks · OAMathWorks interview questions
  • Out-of-Order TLV File ReassemblyApplied Intuition · PHONE SCREENApplied Intuition interview questions
  • Customer Bootstrap APIDoorDash · PHONE SCREEN · ONSITE INTERVIEWDoorDash interview questions
  • Random Bingo Card GeneratorUber · ONSITE INTERVIEWUber interview questions
  • Sustained Overspeed AlertsFleetx · ONSITE INTERVIEW
  • Generic Stack Operation SequenceArista Networks · PHONE SCREEN · ONSITE INTERVIEWArista Networks interview questions
  • Spiral MatrixAthenahealth · ONSITE INTERVIEW

Interview reports that mention this question

  • Stripe SWE Intern Shipping and BitFont Offer: 1 Experience

Stripe interview experiences

  • Stripe New Grad SWE OA and Phone Screen: 2 Experiences
  • Stripe Experienced SWE OA and Onsite Questions: 3 Experiences
  • Stripe SWE Intern Linked Merchants Team Screen: 1 Experience
  • Stripe OA: What It Tests (2026)
  • Stripe SWE Onsite over Two Days: 1 Experience
All Stripe interview questionsSee Stripe hiring insights
Saved
class Solution {
    public int maximumKerning(String[] leftGlyph, String[] rightGlyph) {
        // Write your code here.
    }
}
Checking account…