| Conditions | 4 |
| Paths | 6 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public static function deleteNode(ListNode $head, int $value): ListNode |
||
| 12 | { |
||
| 13 | if ($head->val === $value) { |
||
| 14 | $head = $head->next; |
||
| 15 | } |
||
| 16 | |||
| 17 | $prev = $curr = $head; |
||
| 18 | while ($curr) { |
||
| 19 | if ($curr->val === $value) { |
||
| 20 | $prev->next = $curr->next; |
||
| 21 | } else { |
||
| 22 | $prev = $curr; |
||
| 23 | } |
||
| 24 | $curr = $curr->next; |
||
| 25 | } |
||
| 26 | |||
| 27 | return $head; |
||
|
|
|||
| 28 | } |
||
| 30 |