began problem, solved in o(n)^2, but needs O(n)
This commit is contained in:
parent
e7331f6d89
commit
f5c523e98f
12
Top150Interview/238ProductofArrayExceptSelf.py
Normal file
12
Top150Interview/238ProductofArrayExceptSelf.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
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])
|
||||||
Loading…
Reference in New Issue
Block a user