This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Requirements: | |
| 1. Configuration is provided at startup (loaded once) | |
| 2. System receives requests with (clientId: string, endpoint: string) | |
| 3. Each endpoint has a configuration specifying: | |
| - Algorithm to use (e.g., "TokenBucket", "SlidingWindowLog", etc.) | |
| - Algorithm-specific parameters (e.g., capacity, refillRatePerSecond for Token Bucket) | |
| 4. System enforces rate limits by checking clientId against the endpoint's configuration | |
| 5. Return structured result: (allowed: boolean, remaining: int, retryAfterMs: long | null) | |
| 6. If endpoint has no configuration, use a default limit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Requirements: | |
| 1. Two players take turns dropping discs into a 7-column, 6-row board | |
| 2. A disc falls to the lowest available row in the chosen column | |
| 3. The game ends when: | |
| - A player gets four discs in a row (vertical, horizontal, or diagonal). They win. | |
| - The board is full. It's a draw. | |
| 4. Invalid moves should be rejected clearly: | |
| - Dropping in a full column. | |
| - Moving out of turn. | |
| - Moving after the game is over. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Requirements: | |
| 1. Users can search for movies by title | |
| 2. Users can browse movies playing at a given theater | |
| 3. Theaters have multiple screens; all screens share the same seat layout (rows A-Z, seats 0-20) | |
| 4. Users can view available seats for a showtime and select specific ones | |
| 5. Users can book multiple seats in a single reservation; booking returns a confirmation ID | |
| 6. Concurrent booking of the same seat: exactly one succeeds | |
| 7. Users can cancel a reservation by confirmation ID, releasing the seats | |
| Out of Scope: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Requirements: | |
| 1. System manages 3 elevators serving 10 floors (0-9) | |
| 2. Users can request an elevator from any floor (hall call). System decides which elevator to dispatch. | |
| 3. Once inside, users can select one or more destination floors | |
| 4. Simulation runs in discrete time steps (e.g., a `step()` or `tick()` call advances time) | |
| 5. Elevator stops come in two types: | |
| - Hall calls: Request from a floor with direction (UP or DOWN) | |
| - Destination: Request from inside elevator (no direction specified) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Requirements: | |
| 1. Carrier deposits a package by specifying size (small, medium, large) | |
| - System assigns an available compartment of matching size | |
| - Opens compartment and returns access token, or error if no space | |
| 2. Upon successful deposit, an access token is generated and returned | |
| - One access token per package | |
| 3. User retrieves package by entering access token | |
| - System validates code and opens compartment | |
| - Throws specific error if code is invalid or expired | |
| 4. Access tokens expire after 7 days |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Requirements: | |
| // ----------------------------------------------------------------------------------------- | |
| 1. System supports three vehicle types: Motorcycle, Car, Large Vehicle | |
| 2. When a vehicle enters, system automatically assigns an available compatible spot | |
| 3. System issues a ticket at entry. | |
| 4. When a vehicle exits, user provides ticket ID | |
| - System validates the ticket | |
| - Calculates fee based on time spent (hourly, rounded up) | |
| - Frees the spot for next use | |
| 5. Pricing is hourly with same rate for all vehicles |