Skip to content

Commit 85a277d

Browse files
authored
feat: add php solution to lc problem: No.1672 (doocs#984)
1 parent 068ef10 commit 85a277d

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

solution/1600-1699/1672.Richest Customer Wealth/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,27 @@ class Solution {
189189
}
190190
```
191191

192+
### **PHP**
193+
194+
```php
195+
class Solution {
196+
/**
197+
* @param Integer[][] $accounts
198+
* @return Integer
199+
*/
200+
function maximumWealth($accounts) {
201+
$rs = 0;
202+
for ($i = 0; $i < count($accounts); $i++) {
203+
$sum = 0;
204+
for ($j = 0; $j < count($accounts[$i]); $j++)
205+
$sum += $accounts[$i][$j];
206+
if ($sum > $rs) $rs = $sum;
207+
}
208+
return $rs;
209+
}
210+
}
211+
```
212+
192213
### **...**
193214

194215
```

solution/1600-1699/1672.Richest Customer Wealth/README_EN.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,27 @@ class Solution {
176176
}
177177
```
178178

179+
### **PHP**
180+
181+
```php
182+
class Solution {
183+
/**
184+
* @param Integer[][] $accounts
185+
* @return Integer
186+
*/
187+
function maximumWealth($accounts) {
188+
$rs = 0;
189+
for ($i = 0; $i < count($accounts); $i++) {
190+
$sum = 0;
191+
for ($j = 0; $j < count($accounts[$i]); $j++)
192+
$sum += $accounts[$i][$j];
193+
if ($sum > $rs) $rs = $sum;
194+
}
195+
return $rs;
196+
}
197+
}
198+
```
199+
179200
### **...**
180201

181202
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution {
2+
/**
3+
* @param Integer[][] $accounts
4+
* @return Integer
5+
*/
6+
function maximumWealth($accounts) {
7+
$rs = 0;
8+
for ($i = 0; $i < count($accounts); $i++) {
9+
$sum = 0;
10+
for ($j = 0; $j < count($accounts[$i]); $j++)
11+
$sum += $accounts[$i][$j];
12+
if ($sum > $rs) $rs = $sum;
13+
}
14+
return $rs;
15+
}
16+
}

0 commit comments

Comments
 (0)