Amortised Cost of a Growing Array
Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.
The problem
- medium
- Pro
A dynamic array, such as a Python list or a Java ArrayList, grows its capacity by a constant factor, often doubling, when it fills up. Explain why appending is said to take constant time even though some appends copy everything.
Talk this problem through with an AI coach
This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.