增加(0206.翻转链表.md):php版本

This commit is contained in:
SevenMonths
2022-05-24 19:56:37 +08:00
parent b78e750f8f
commit 4405be238d

View File

@ -497,5 +497,20 @@ struct ListNode* reverseList(struct ListNode* head){
}
```
PHP:
```php
// 双指针法:
function reverseList($head) {
$cur = $head;
$pre = NULL;
while($cur){
$temp = $cur->next;
$cur->next = $pre;
$pre = $cur;
$cur = $temp;
}
return $pre;
}
```
-----------------------
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>