← Questions

How strings are stored and what copying them costs

0
Character.AICodingLast asked Jul 2025

What is a string under the hood? Describe the fields a string struct holds and how you would implement one yourself, then give the time cost of copying a string and of common operations on it. Expect follow-ups on how languages avoid needless copies.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding