LeetCode/Top150Interview/238ProductofArrayExceptSelf.py

12 lines
271 B
Python

def productExceptSelf(nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
answer = nums
for i in range(len(nums)):
if answer[i] == nums[i]:
return answer
productExceptSelf([1,2,3,4])