Skip to content

Commit 3807c9b

Browse files
authored
feat: add php solution to lc problem: No.1732 (doocs#1035)
1 parent a56bc66 commit 3807c9b

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

solution/1700-1799/1732.Find the Highest Altitude/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,25 @@ int largestAltitude(int *gain, int gainSize) {
179179
}
180180
```
181181
182+
### **PHP**
183+
184+
```php
185+
class Solution {
186+
/**
187+
* @param Integer[] $gain
188+
* @return Integer
189+
*/
190+
function largestAltitude($gain) {
191+
$max = 0;
192+
for ($i = 0; $i < count($gain); $i++) {
193+
$tmp += $gain[$i];
194+
if ($tmp > $max) $max = $tmp;
195+
}
196+
return $max;
197+
}
198+
}
199+
```
200+
182201
### **...**
183202

184203
```

solution/1700-1799/1732.Find the Highest Altitude/README_EN.md

+19
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,25 @@ int largestAltitude(int *gain, int gainSize) {
149149
}
150150
```
151151
152+
### **PHP**
153+
154+
```php
155+
class Solution {
156+
/**
157+
* @param Integer[] $gain
158+
* @return Integer
159+
*/
160+
function largestAltitude($gain) {
161+
$max = 0;
162+
for ($i = 0; $i < count($gain); $i++) {
163+
$tmp += $gain[$i];
164+
if ($tmp > $max) $max = $tmp;
165+
}
166+
return $max;
167+
}
168+
}
169+
```
170+
152171
### **...**
153172

154173
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
/**
3+
* @param Integer[] $gain
4+
* @return Integer
5+
*/
6+
function largestAltitude($gain) {
7+
$max = 0;
8+
for ($i = 0; $i < count($gain); $i++) {
9+
$tmp += $gain[$i];
10+
if ($tmp > $max) $max = $tmp;
11+
}
12+
return $max;
13+
}
14+
}

0 commit comments

Comments
 (0)