FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Create LeetCode_83_12.php · feixiangcode/algorithm@bb51ffd · GitHub

Commit bb51ffd

Browse files
authored
Create LeetCode_83_12.php
1 parent 5ac9578 commit bb51ffd

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎Week_01/id_12/LeetCode_83_12.php‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Definition for a singly-linked list.
3+
* class ListNode {
4+
* public $val = 0;
5+
* public $next = null;
6+
* function __construct($val) { $this->val = $val; }
7+
* }
8+
*/
9+
10+
class Solution {
11+
public function deleteDuplicates($headNode) {
12+
$current = $headNode;
13+
while($current->next !=null){
14+
if($current->val == $current->next->val ){
15+
$current->next = $current->next->next;
16+
}else{
17+
$current = $current->next;
18+
}
19+
}
20+
return $headNode;
21+
}
22+
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL