测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A66860. 下⾯的代码⽚段⽤于反转单链表 ,请进⾏( ) 修改 ,使其能正确实现相应功能。1 ListNode* reverseLinked List(ListNode* head) {

单选题

题目描述

下⾯的代码⽚段⽤于反转单链表 ,请进⾏(  ) 修改 ,使其能正确实现相应功能。

1 ListNode* reverseLinked List(ListNode* head) {
2  ListNode* prev = nullptr;
3  ListNode* current = head;
4  while (current != nullptr) {
5   ListNode* next = current->next;
6   current->next = next;
7   prev = current;
8   current = next;
9  }
10  return prev;
11 }

选项(单选)