Jane StreetCursor

Verified interview challenge

Build and verify Merkle proofs

Build a Merkle tree, generate inclusion proofs and decide whether a supplied proof supports a claimed root.

Unlock with Full Access

The challenge

The task combines tree traversal with exact hashing rules. Construct a tree from the supplied leaf values, return its root and produce proofs for selected leaves. Your verifier must also handle externally supplied proofs, including malformed entries, without relying on the original tree.

What you'll practise

  • Byte-exact hashing

    Follow the specified leaf and parent encodings so the computed root matches the contract.

  • Proof construction

    Track a leaf's path through the tree, including uneven levels.

  • Independent verification

    Check supplied proofs and reject malformed data without borrowing state from the original tree.

Your coding workspacePreview
solution.pyPython 3.13
def merkle_results(
    leaves, operations
):
    # Your implementation goes here
    pass
Test cases

Run your code to see results.

Full instructions, starter code and test cases included with Full Access.