Leetcode Subarray Products Hackerrank Python Problem