Leetcode Subarray Products Hackerrank Java