Rate Limiter System
Part 1 — Binary Search: Find the minimum tier for a given request volume.
tiers = [
{"tier": "free", "max_requests": 100},
{"tier": "basic", "max_requests": 1000},
{"tier": "pro", "max_requests": 10000},
{"tier": "enterprise", "max_requests": 100000},
]
find_tier(5000, tiers) → "pro"
Part 2 — Recursion: Calculate total leaf capacity in an infrastructure tree.
total_capacity(node) → sum of all leaf max_capacity values
Part 3 — Graph: Calculate total cost of calling an endpoint (including all dependencies).
calculate_cost("/user/profile", graph) → 4 (1 + deps)
Hints
solution.py
Python ready
Test Output
▶
Click "Run Tests" to execute your code