Leetcode Implement Dynamic Array Cpp