{"id":"two-stack-queue-amortized-o1","text":"Every element in `MyQueue` is transferred from `_in_stack` to `_out_stack` exactly once across its lifetime, so `push`, `pop`, and `peek` are all amortized O(1) despite O(n) worst-case transfers.","truth_value":"IN","source":"entries/2026/06/06/implement-queue-using-stacks-solution.md","source_url":"","source_hash":"","justifications":[],"dependents":["two-stack-queue-amortized-via-lazy-transfer"],"metadata":{},"created_at":"","updated_at":"","reviewed_at":"","verified_at":"","retracted_at":"","explanation":{"steps":[{"node":"two-stack-queue-amortized-o1","truth_value":"IN","reason":"premise"}]}}