File tree 3 files changed +61
-0
lines changed
solution/1400-1499/1475.Final Prices With a Special Discount in a Shop
3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,28 @@ impl Solution {
370
370
}
371
371
```
372
372
373
+ ### ** PHP**
374
+
375
+ ``` php
376
+ class Solution {
377
+ /**
378
+ * @param Integer[] $prices
379
+ * @return Integer[]
380
+ */
381
+ function finalPrices($prices) {
382
+ for ($i = 0; $i < count($prices); $i++) {
383
+ for ($j = $i + 1; $j < count($prices); $j++) {
384
+ if ($prices[$i] >= $prices[$j]) {
385
+ $prices[$i] -= $prices[$j];
386
+ break;
387
+ }
388
+ }
389
+ }
390
+ return $prices;
391
+ }
392
+ }
393
+ ```
394
+
373
395
### ** ...**
374
396
375
397
```
Original file line number Diff line number Diff line change @@ -341,6 +341,28 @@ impl Solution {
341
341
}
342
342
```
343
343
344
+ ### ** PHP**
345
+
346
+ ``` php
347
+ class Solution {
348
+ /**
349
+ * @param Integer[] $prices
350
+ * @return Integer[]
351
+ */
352
+ function finalPrices($prices) {
353
+ for ($i = 0; $i < count($prices); $i++) {
354
+ for ($j = $i + 1; $j < count($prices); $j++) {
355
+ if ($prices[$i] >= $prices[$j]) {
356
+ $prices[$i] -= $prices[$j];
357
+ break;
358
+ }
359
+ }
360
+ }
361
+ return $prices;
362
+ }
363
+ }
364
+ ```
365
+
344
366
### ** ...**
345
367
346
368
```
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ /**
3
+ * @param Integer[] $prices
4
+ * @return Integer[]
5
+ */
6
+ function finalPrices ($prices ) {
7
+ for ($i = 0 ; $i < count ($prices ); $i ++ ) {
8
+ for ($j = $i + 1 ; $j < count ($prices ); $j ++ ) {
9
+ if ($prices [$i ] >= $prices [$j ]) {
10
+ $prices [$i ] -= $prices [$j ];
11
+ break ;
12
+ }
13
+ }
14
+ }
15
+ return $prices ;
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments