← Stripe Interview Insights

Stripe·Software Engineer·Onsite - Coding / Algorithms·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Stripe coding round for a Software Engineer role, focused on a 'review-assignment' problem using JGit. The task was interesting but the official JGit docs were down, which made setup a real pain. Small config mistake killed my Part 1 output even though the logic itself was fine.

Questions Asked (1)

Q1

Using JGit, write code to compare two branches of a git repository, then use a CSV file mapping files to owners to find which owner had the most files changed. The goal is to simulate automatic reviewer assignment after a pull request is opened.

API & IntegrationsAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

The logic was actually solid.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and assumptions, then outline the algorithm: use JGit to resolve the two branch refs, compute the diff between their commit trees, extract changed file paths, and aggregate counts per owner using the CSV mapping. Finally, discuss trade-offs like performance, edge cases, and how this fits into a larger automated reviewer assignment system.

Pro tip: Mention that you would cache the file-to-owner mapping and use a streaming CSV parser for large repositories, and that you would handle renames and binary files explicitly to avoid incorrect owner attribution.

1. Clarify Requirements and Assumptions

Ask about the repository size, branch comparison semantics (e.g., merge-base vs. direct diff), and the CSV format. Confirm whether to consider only added/modified files or also deleted files.

2. Set Up JGit and Resolve Branches

Use JGit's Repository and Git classes to open the repo and resolve the two branch names to ObjectId (commit SHA). Handle exceptions like missing branches.

3. Compute Diff and Extract Changed Files

Use DiffCommand or TreeWalk to compute the diff between the two commits. Collect the list of changed file paths, handling renames and binary files appropriately.

4. Map Files to Owners and Count

Load the CSV mapping (file path -> owner) into a map. For each changed file, look up the owner and increment a counter. Use a HashMap<String, Integer> for counts.

5. Determine Top Owner and Discuss Integration

Find the owner with the maximum count. Discuss how this could be integrated into a CI/CD pipeline or webhook to automatically assign reviewers, and mention scalability considerations.

Key Points to Mention

  • Use of JGit's DiffCommand or TreeWalk to compute differences between commits
  • Handling of file renames and binary files in diff to avoid misattribution
  • Efficient CSV parsing and caching of the file-to-owner mapping
  • Edge cases: empty diff, missing owner mapping, large repositories
  • Trade-offs: performance vs. accuracy, merge-base vs. direct diff
  • Integration with pull request events (e.g., GitHub webhooks) for automatic reviewer assignment

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.