Deviopath › Go

Clone Without Sharing

Hard · Performance

append can alias the backing array. Return a clone of nums that is safe to mutate without changing the original. Use copy into a new slice of the same length.

RunClone(nums) is already written: it clones, mutates index 0 of the clone if non-empty, and returns [original0, clone0] (or [0,0] if empty).

Next: Repository Port