We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents dc88b16 + afc9e07 commit 62d5b78Copy full SHA for 62d5b78
problems/0343.整数拆分.md
@@ -469,6 +469,34 @@ object Solution {
469
}
470
```
471
472
+
473
+### PHP
474
+```php
475
+class Solution {
476
477
+ /**
478
+ * @param Integer $n
479
+ * @return Integer
480
+ */
481
+ function integerBreak($n) {
482
+ if($n == 0 || $n == 1) return 0;
483
+ if($n == 2) return 1;
484
485
+ $dp = [];
486
+ $dp[0] = 0;
487
+ $dp[1] = 0;
488
+ $dp[2] = 1;
489
+ for($i=3;$i<=$n;$i++){
490
+ for($j = 1;$j <= $i/2; $j++){
491
+ $dp[$i] = max(($i-$j)*$j, $dp[$i-$j]*$j, $dp[$i]);
492
+ }
493
494
495
+ return $dp[$n];
496
497
+}
498
+```
499
500
<p align="center">
501
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
502
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
0 commit comments