xAI

Verified interview challenge

Build a radix cache for integer sequences

Store shared sequence prefixes in compressed edges, then support insertion conflicts and queries.

Unlock with Full Access

The challenge

Build a prefix tree that stores runs of integers on compressed edges. Inserting a sequence can require splitting an existing edge without losing the sequences already represented below it.

Extend the same structure through insertion, exact search, prefix matching and enumeration. The implementation should navigate the compressed tree rather than repeatedly scan every stored sequence.

What you'll practise

  • Edge splitting

    Preserve existing sequences when an inserted sequence diverges inside an edge.

  • Prefix queries

    Navigate compressed paths correctly for exact matches and related sequences.

Your coding workspacePreview
Current partFurther parts unlock as you progress
solution.pyPython 3.13
# Build on your implementation

# Run checks for the current part

# Full starter code included
Current-part checks

Run your code to see results.

The complete sequence, starter code and checks are included with Full Access.