Stripe OA 2026 | SSE3
- Posted
- 19 Aug 2026
Summary
I completed a Stripe online assessment consisting of three parts involving region registration, distance calculation, and routing logic.
How it went
Store all datacentres and their details. Calculate the routing distance
Part 1:
Input:-
REGISTER <region> <latitude> <longitude> <capacity>
SET_HEALTHZ <region> <state>
Sample Input:-
REGISTER us-east-1 38 120 100
REGISTER us-west-2 50 112 30
SET_HEALTHZ us-west-2 false
REGISTER eu-east-1 -10 15 0
Output:-
OK (if register is successful)
ERROR (if it fails the rules)
Rules:
- Latitude should be between [-90,90]
- Longitude should be between [-180,180]
- capacity should be > 0
- Region should not already been registered for REGISTER call but should be registered for SET_HEALTHZ call
- Assume latitude and longitude are integers and so is capacity. healthz will always be boolean
- By default new regions are always healthy
Part 2:
Calculate the Haversine distance between two sets of coordinates. (Haversine algorithm is given for implementation)
Input:-
DISTANCE <lat1> <long1> <lat2> <long2>
Sample input:-
DISTANCE 0 0 100 100
Output:-
10200
Constraints:- Input will be integer and output needs to be rounded to integer
Part 3:-
Calculate proximity routing for the given coordinates to a region registered and return the only healthy region and which can handle the load and possible candidates for the routing. Also add the distance of the region from the request. (Based on haversine in part 2)
Input:-
ROUTE <latitude> <longitude>
Sample Input:-
REGISTER us-east-1 0 0 1
REGISTER ap-south-1 0 0 1
ROUTE 0 0
SET_HEALTHZ ap-south-1 false
ROUTE 0 0
Output:-
OK
OK
us-east-1 0 us-east-1 ap-south-1
NONE 0 us-east-1
Rules:
- If a region is unhealthy dont include it in candidates as well as it cannot be a node on which it is routed.
- Load initially of all registered regions is 0
- If no region can be routed for the request, output NONE and the haversine distance will be 0 in that case
- Latitude and longitude constraints are same as part 1
- Region needs to be choosen based on distance and if distance is same, then alphabetical order
Time limt is 1Hr and need to process input and output from scratch. Platform is hackerrank.
Questions asked (3)
- 01
Region Registration and Health Check
Data Structures & Algorithms
Implement commands to register regions with latitude, longitude, and capacity, and to set their health status. The
REGISTERcommand should validate latitude ([-90,90]), longitude ([-180,180]), capacity (>0), and ensure the region is not already registered. TheSET_HEALTHZcommand should only apply to already registered regions. OutputOKfor successful operations andERRORotherwise. - 02
Haversine Distance Calculation
Data Structures & Algorithms
Given two sets of latitude and longitude coordinates, calculate the Haversine distance between them. Input format:
DISTANCE <lat1> <long1> <lat2> <long2>. Output the distance rounded to the nearest integer. - 03
Proximity Routing to Healthy Regions
Data Structures & Algorithms
Given a request coordinate, find the healthiest registered region that can handle the load, preferring the closest region (using Haversine distance) and breaking ties alphabetically. Output the selected region, its distance, and possible candidate regions. If no healthy region is available, output
NONEwith distance 0.