mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 07:35:35 +08:00
Merge pull request #1989 from fwqaaq/master
Update 24. 两两交换链表中的节点 about rust 优化
This commit is contained in:
@ -409,7 +409,7 @@ impl Solution {
|
|||||||
// 递归
|
// 递归
|
||||||
impl Solution {
|
impl Solution {
|
||||||
pub fn swap_pairs(head: Option<Box<ListNode>>) -> Option<Box<ListNode>> {
|
pub fn swap_pairs(head: Option<Box<ListNode>>) -> Option<Box<ListNode>> {
|
||||||
if head == None || head.as_ref().unwrap().next == None {
|
if head.is_none() || head.as_ref().unwrap().next.is_none() {
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user