Leetcode Problem On Array In Math