Leetcode Problem On Array Methods In Cpp