Concept: amortized analysis
Most appends are constant-time writes to an internal buffer. Occasionally the buffer fills and the array doubles, copying all existing elements - that single append is O(n). But because the buffer doubles, those expensive appends are rare enough that the **amortized** cost across `n` appends is bounded by 2n total writes - **O(1) amortized per append**. The worst-case-per-append is O(n); make sure the question is asking for amortized when you give this answer.