Leetcode Coding Exercise On Numpy Array Python