• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

1、反转链表

思路:新建一个临时雇员节点,双指针后移

ContractedBlock.gif

ExpandedBlockStart.gif

/*

公共类列表节点{

int值

ListNode next=null

ListNode(int val) {

this.val=val

}

}*/

公共类解决方案{

公共列表节点反向列表(列表节点头){

if(head==null | | head。next==null){

回程头;}

ListNode a=head

ListNode b=head.next

而(b!=空)

{

列表节点c=b . next

乙。next=a;

a=b;

b=c;

}

head.next=null

返回a;

}

}

查看代码

Link to comment
Share on other sites