leetcode 日经贴,Cpp code -Remove Nth Node From End of List
来源:互联网 发布:360免费wifi网络不稳定 编辑:程序博客网 时间:2024/06/05 16:00
Remove Nth Node From End of List
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* removeNthFromEnd(ListNode* head, int n) { if (!head) { return head; } ListNode *p = head; for (int i = 0; i < n; ++i) { p = p->next; } if (!p) { return head->next; } ListNode *c = head; while (p->next) { p = p->next; c = c->next; } c->next = c->next->next; return head; }};
0 0
- leetcode 日经贴,Cpp code -Remove Nth Node From End of List
- the code of Remove Nth Node From End of List
- CODE 112: Remove Nth Node From End of List
- [leet code] Remove Nth Node From End of List
- Leet Code 19 Remove Nth Node From End of List
- Leetcode 19. Remove Nth Node From End of List (Easy) (cpp)
- LeetCode[Linked List]: Remove Nth Node From End of List
- 19. Remove Nth Node From End of List leetcode list
- [Leetcode]LeetCode 19:Remove Nth Node From End of List
- LeetCode: Remove Nth Node From End of List
- LeetCode: Remove Nth Node From End of List
- [Leetcode] Remove Nth Node From End of List
- LeetCode: Remove Nth Node From End of List
- leetcode 40: Remove Nth Node From End of List
- [LeetCode] Remove Nth Node From End of List
- Leetcode 19 Remove Nth Node From End of List
- [Leetcode] Remove Nth Node From End of List
- [LeetCode]Remove Nth Node From End of List
- javascript中的定时器
- android上播放按键声音方法
- 代理与反向代理
- EasyGui 学习文档【超详细中文版】[增强版]
- 官网地址
- leetcode 日经贴,Cpp code -Remove Nth Node From End of List
- 关于OC 特有的语法
- ios实现长时间后台运行
- ubuntu14.04(64位)运行32位程序
- 使用sos查看.NET对象内存布局
- C/C++ struct位结构(位域)
- 弗罗贝尼乌斯范数
- php mvc模式
- ACdream 1061(abs用法)