Leetcode Nested Array Python