[leetcode]24. Swap Nodes in Pairs -- JavaScript 代码
来源:互联网 发布:server name 多个域名 编辑:程序博客网 时间:2024/06/07 10:34
/** * Definition for singly-linked list. * function ListNode(val) { * this.val = val; * this.next = null; * } *//** * @param {ListNode} head * @return {ListNode} */var swapPairs = function(head) { if(head===null || head.next===null) return head; var tmp = head; head = head.next; var thelast = null; while(tmp!==null && tmp.next!==null){ next = tmp.next; next2 = next.next; next.next = tmp; tmp.next = next2; if(thelast!==null){ thelast.next = next; } thelast = tmp; tmp = next2; } return head;};
0 0
- [leetcode]24. Swap Nodes in Pairs -- JavaScript 代码
- [leetcode javascript解题]Swap Nodes in Pairs
- [LeetCode]24.Swap Nodes in Pairs
- 24. Swap Nodes in Pairs Leetcode Python
- LeetCode --- 24. Swap Nodes in Pairs
- LeetCode 24.Swap Nodes in Pairs
- [Leetcode] 24. Swap Nodes in Pairs
- 【LeetCode】24.Swap Nodes in Pairs
- [leetcode] 24.Swap Nodes in Pairs
- **LeetCode 24. Swap Nodes in Pairs
- 24. Swap Nodes in Pairs LeetCode
- leetcode 24. Swap Nodes in Pairs
- leetcode 24. Swap Nodes in Pairs
- LeetCode--24. Swap Nodes in Pairs
- leetcode 24. Swap Nodes in Pairs
- 【LeetCode】24. Swap Nodes in Pairs
- [leetcode] 24. Swap Nodes in Pairs
- LeetCode 24. Swap Nodes in Pairs
- 在html中向table中动态添加内容,并设置cell字体颜色
- 2016.08.18 初中部 NOIP普及组 模拟赛
- JavaWeb的数据库操作:通过JDBC连接MySQL数据库实现图书信息添加功能
- array_walk
- Mysql服务器查询慢原因分析
- [leetcode]24. Swap Nodes in Pairs -- JavaScript 代码
- Flatten Binary Tree to Linked List leetcode
- JFinal配置类 JFinalConfig
- H264 NALU分析(sps,pps,关键帧,非关键帧)
- ScrollPic.js——图片左右滚动插件(单一功能)
- 入网认证遇到的安全受控机制的问题---之Android 5.1.1 AppOps与严格模式
- WTC中tuxedo返回错误
- mac电脑nodejs使用npm方式安装express
- RAM 、ROM、DRAM、SRAM与NAND FLASH、 NOR FLASSH的区别