← Stripe Interview Insights

Stripe·Software Engineer·Online Assessment (OA)·Intermediate

IntermediatePrefer not to say
May 2026Remote

Summary

Stripe SWE coding round, one problem about building a mini datacenter routing system with command parsing and input validation. Pretty self-contained but the edge cases were sneaky.

Questions Asked (1)

Q1

Implement two commands for a datacenter routing system: REGISTER (with strict validation on lat/lon range, positive capacity, and unique name) and SET_HEALTHY (to toggle a flag on existing datacenters). Print OK or ERROR for each command based on whether it succeeds.

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

The validation rules look obvious on paper but I initially forgot that capacity zero should also fail, not just negatives.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the command interface and validation rules, then design a data structure that supports O(1) registration and health toggling. Implement the commands with strict input validation, ensuring unique names and proper error handling, and test edge cases like boundary coordinates and duplicate names.

Pro tip: Mention that you would use a hash map for O(1) lookups and discuss how to handle floating-point precision for lat/lon validation. Also, consider thread-safety if the system is concurrent, as Stripe values robust, production-ready code.

1. Clarify Requirements and Edge Cases

Ask about input format, expected output, and any constraints like maximum number of datacenters or concurrency. Identify edge cases such as boundary values for lat/lon, zero capacity, and duplicate names.

2. Design Data Structures

Choose a hash map (e.g., dictionary) to store datacenters by name for O(1) access. Each datacenter record should include name, latitude, longitude, capacity, and a healthy flag.

3. Implement Validation Logic

For REGISTER, validate that latitude is between -90 and 90, longitude between -180 and 180, capacity is positive, and name is unique. For SET_HEALTHY, validate that the datacenter exists and the healthy flag is a boolean.

4. Handle Commands and Output

Parse each command, execute the corresponding operation, and print OK if successful or ERROR if validation fails. Ensure that failed operations do not modify the state.

5. Test and Discuss Trade-offs

Walk through test cases including valid and invalid inputs. Discuss time/space complexity (O(1) per operation) and potential improvements like thread-safety or persistence.

Key Points to Mention

  • Use a hash map for O(1) registration and lookup by name.
  • Validate latitude in [-90, 90] and longitude in [-180, 180], handling floating-point precision carefully.
  • Ensure capacity is a positive integer (or float) and reject zero or negative values.
  • Check for duplicate names before insertion and return ERROR without modifying state.
  • For SET_HEALTHY, verify the datacenter exists and the healthy flag is a boolean.
  • Discuss trade-offs: simplicity vs. concurrency, and potential need for persistence or scaling.

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