{"id":"tickets-simulation-avoidance","text":"`time_to_buy_tickets` replaces an O(n·max(tickets)) queue simulation with an O(n) single-pass formula that computes each person's contribution based on their position relative to index k.","truth_value":"IN","source":"entries/2026/06/06/time-needed-to-buy-tickets-solution.md","source_url":"","source_hash":"","justifications":[],"dependents":[],"metadata":{},"created_at":"","updated_at":"","reviewed_at":"","verified_at":"","retracted_at":"","explanation":{"steps":[{"node":"tickets-simulation-avoidance","truth_value":"IN","reason":"premise"}]}}