{"id":"simulation-to-formula-pattern","text":"Multiple solutions (e.g., `time_to_buy_tickets`) replace explicit round-by-round simulation with per-element contribution formulas, reducing time complexity from O(n·k) to O(n) by reasoning about how many rounds each element participates in.","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":"simulation-to-formula-pattern","truth_value":"IN","reason":"premise"}]}}