Skip to content

Commit b1f425a

Browse files
committed
Add solution 27.
1 parent ed42654 commit b1f425a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution {
2+
3+
/**
4+
* @param Integer[] $nums
5+
* @param Integer $val
6+
* @return Integer
7+
*/
8+
function removeElement(&$nums, $val) {
9+
$start = 0;
10+
for($i = 0; $i < count($nums); $i++){
11+
if($nums[$i] != $val){
12+
$nums[$start] = $nums[$i];
13+
$start++;
14+
}
15+
}
16+
17+
return $start;
18+
}
19+
}

0 commit comments

Comments
 (0)