Final Prices With a Special Discount in a Shop LeetCode solution in Python

1
class Solution:
2
def finalPrices(self, prices: List[int]) -> List[int]:
3
for i in range(len(prices)):
4
for j in range(i + 1, len(prices)):
5
if prices[j] <= prices[i]:
6
prices[i] = prices[i] - prices[j]
7
break
8
return prices

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0