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

1
class Solution {
2
public int[] finalPrices(int[] prices) {
3
for (int i = 0; i < prices.length; i++) {
4
for (int j = i + 1; j < prices.length; j++) {
5
if (j > i && prices[j] <= prices[i]) {
6
prices[i] -= prices[j];
7
break;
8
}
9
}
10
}
11
return prices;
12
}
13
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0