The legacy codebase you were moved to 'temporarily, for a quarter' (year three now) bans the STL in its core module — an architect decreed it in 2009 and the decree outlived his tenure. You need a string class: copying, moving, no leaks. Yes, in 2026. No, it's not up for discussion.
Implement a String that owns a heap-allocated character buffer. This is the canonical rule of five interview task: deep copy, safe self-assignment, and move semantics — no algorithms, pure C++ value semantics.
Adapted from exercism/cpp (MIT).
s = s)operator+ returns a new concatenated Stringoperator= guard against self-assignment?String satisfy so its destructor is safe?Store an owning char* and the length; always keep a null terminator.
Copy makes a deep copy; move steals the buffer and leaves the source as a valid empty string.
Hit Submit (or ⌘/Ctrl + ↵) — test results will show up here.