Untitled
class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: prefix, suffix = [1], [1] for num in nums[:-1] prefix.append(prefix[-1] * num) for num in reversed(nums[1:]): suffix.append(suffix[-1] * num) return [prefix[i]*suffix[-i-1] for i in range(len(nums))]