A container exposes its editing operations through operators, each with a fixed meaning: append, prepend, repeat, remove. The catch is the int on the LEFT side — 0 + a cannot be a member function, so half the operators must live outside the class.
Implement Array with operator algebra: a + 1 appends, 0 + a prepends, 2 * a repeats the content twice, a - 1 removes every occurrence of 1. operator[] reads elements for the checks.
A member operator+ only covers a + x. For x + a write a free function (friend) taking (int, const Array&).
Build each result in a fresh Array — the checks reassign a = ... every line, so value semantics keep it simple.
Hit Submit (or ⌘/Ctrl + ↵) — test results will show up here.