Logo

Coding preview

Implement new using something else.

What this preview is

About this preview

Implement new using something else. is a medium quant coding problem on language knowledge in Cpp.

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.

Implementing manual memory management in C++

This medium-difficulty coding problem tests your understanding of how new and delete actually work under the hood. It requires you to separate the two phases of object lifecycle—raw allocation and construction—and handle both cleanly, with proper exception safety.

The core challenge is managing the invariant that if construction fails, allocated memory must be freed before the exception propagates, and for arrays, all partially-constructed objects must be torn down in reverse order. This demands careful placement of try-catch blocks and understanding when destructors run.

  • Placement new syntax and semantics
  • Exception-safe resource acquisition and cleanup
  • Destructor ordering and array lifetime management
  • The relationship between malloc, operator new, and construction