| 46 | """ |
| 47 | |
| 48 | class Solution(object): |
| 49 | def maxProduct(self, nums): |
| 50 | """ |
| 51 | :type nums: List[int] |
| 52 | :rtype: int |
| 53 | """ |
| 54 | |
| 55 | maxes = nums[0] |
| 56 | currentNums = [[nums[0]]] |
| 57 | |
| 58 | for i in range(1, len(nums)): |
| 59 | x = nums[i] |
| 60 | temp = [x*j for j in currentNums[i-1]] |
| 61 | |
| 62 | minx = min(x, min(temp)) |
| 63 | maxx = max(x, max(temp)) |
| 64 | |
| 65 | currentNums.append([minx, maxx]) |
| 66 | maxes = max(maxes, maxx) |
| 67 | |
| 68 | return maxes |
| 69 | |
| 70 | # maxes = nums[0] |
| 71 | # currentNums = [[nums[0]]] |
| 72 | |
| 73 | # for i in nums[1:]: |
| 74 | # if not currentNums: |
nothing calls this directly
no outgoing calls
no test coverage detected