Leetcode Array And Hashing In Python Iteration Process