Skip to content

Commit 8e5e18b

Browse files
committed
fix: update
1 parent c4fbd76 commit 8e5e18b

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

solution/1400-1499/1475.Final Prices With a Special Discount in a Shop/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,17 @@ public:
142142
```go
143143
func finalPrices(prices []int) []int {
144144
stk := []int{}
145-
for i := len(prices) - 1; i >= 0; i-- {
146-
x := prices[i]
147-
for len(stk) > 0 && stk[len(stk)-1] > x {
148-
stk = stk[:len(stk)-1]
149-
}
150-
if len(stk) > 0 {
151-
prices[i] -= stk[len(stk)-1]
152-
}
153-
stk = append(stk, x)
154-
}
155-
return prices
145+
for i := len(prices) - 1; i >= 0; i-- {
146+
x := prices[i]
147+
for len(stk) > 0 && stk[len(stk)-1] > x {
148+
stk = stk[:len(stk)-1]
149+
}
150+
if len(stk) > 0 {
151+
prices[i] -= stk[len(stk)-1]
152+
}
153+
stk = append(stk, x)
154+
}
155+
return prices
156156
}
157157
```
158158

solution/1400-1499/1475.Final Prices With a Special Discount in a Shop/README_EN.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,17 @@ public:
143143
```go
144144
func finalPrices(prices []int) []int {
145145
stk := []int{}
146-
for i := len(prices) - 1; i >= 0; i-- {
147-
x := prices[i]
148-
for len(stk) > 0 && stk[len(stk)-1] > x {
149-
stk = stk[:len(stk)-1]
150-
}
151-
if len(stk) > 0 {
152-
prices[i] -= stk[len(stk)-1]
153-
}
154-
stk = append(stk, x)
155-
}
156-
return prices
146+
for i := len(prices) - 1; i >= 0; i-- {
147+
x := prices[i]
148+
for len(stk) > 0 && stk[len(stk)-1] > x {
149+
stk = stk[:len(stk)-1]
150+
}
151+
if len(stk) > 0 {
152+
prices[i] -= stk[len(stk)-1]
153+
}
154+
stk = append(stk, x)
155+
}
156+
return prices
157157
}
158158
```
159159

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
func finalPrices(prices []int) []int {
22
stk := []int{}
3-
for i := len(prices) - 1; i >= 0; i-- {
4-
x := prices[i]
5-
for len(stk) > 0 && stk[len(stk)-1] > x {
6-
stk = stk[:len(stk)-1]
7-
}
8-
if len(stk) > 0 {
9-
prices[i] -= stk[len(stk)-1]
10-
}
11-
stk = append(stk, x)
12-
}
13-
return prices
3+
for i := len(prices) - 1; i >= 0; i-- {
4+
x := prices[i]
5+
for len(stk) > 0 && stk[len(stk)-1] > x {
6+
stk = stk[:len(stk)-1]
7+
}
8+
if len(stk) > 0 {
9+
prices[i] -= stk[len(stk)-1]
10+
}
11+
stk = append(stk, x)
12+
}
13+
return prices
1414
}

0 commit comments

Comments
 (0)