Register Data Centers and Route to the Nearest Healthy Region
Last updated: August 13, 2026
Quick Overview
You are asked to implement a system for registering data centers and managing their health statuses, including handling commands to register data centers and set their health states.
Stripe
August 13, 202639
0
348 solved
You are asked to implement a system for registering data centers and managing their health statuses, including handling commands to register data centers and set their health states.
This question is typically asked during the online assessment round for software engineering roles at Stripe. The interviewer is evaluating the candidate's ability to design and implement a basic command processing system while ensuring data integrity and handling edge cases. The focus is on coding skills, understanding of data structures, and ability to follow specifications accurately.
What the Interviewer Expects
- Correctly implement the REGISTER and SET_HEALTHZ commands.
- Validate input parameters according to specified rules.
- Use appropriate data structures to store data center information.
- Handle edge cases, such as invalid inputs or commands.
- Provide clear and efficient code with comments explaining key sections.
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you extend this system to support more commands?
- What changes would you make to improve performance with a large number of data centers?
- Can you discuss how you would handle concurrency in this system?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Approach
To solve the problem, I will create a class to represent a data center, which will store its region, coordinates, capacity, and health status. I will then implement a command processor that can handle...
Algorithm
The algorithm will involve parsing input commands and updating the internal state of the data centers accordingly. For the REGISTER command, I will check if the provided latitude and longitude are wit...