• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ying_vincent
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 27 下一页
2013年4月20日
LeetCode: Reverse Nodes in k-Group
摘要: 从这题和上一题可以总结出反转链表的经验,需要有5个指针:end, q, p, pPre, pNext. p和pPre进行方向转置后p和pPre向后移,pNext用来记录转置前p的后一个,q用来记录转置串之前的node,end记录转置串最开始的node。 1 /** 2 * Definition f... 阅读全文
posted @ 2013-04-20 13:06 ying_vincent 阅读(155) 评论(0) 推荐(0)
LeetCode: Reverse Linked List II
摘要: 没做出来,看网上答案,这题难度在于编程 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(... 阅读全文
posted @ 2013-04-20 08:45 ying_vincent 阅读(138) 评论(0) 推荐(0)
LeetCode: Reverse Integer
摘要: 一次过 1 class Solution { 2 public: 3 int reverse(int x) { 4 // Start typing your C/C++ solution below 5 // DO NOT write int main() f... 阅读全文
posted @ 2013-04-20 07:13 ying_vincent 阅读(132) 评论(0) 推荐(0)
LeetCode: Restore IP Addresses
摘要: erase的时候没考虑到.加上去之后删除位置的变化,基本一次过,少数次过 1 class Solution { 2 public: 3 void dfs(vector &ret, string tmp, string s, int dep, int maxsize, int beg) { 4... 阅读全文
posted @ 2013-04-20 07:08 ying_vincent 阅读(232) 评论(0) 推荐(0)
LeetCode: Remove Nth Node From End of List
摘要: 一次过 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x),... 阅读全文
posted @ 2013-04-20 06:33 ying_vincent 阅读(130) 评论(0) 推荐(0)
LeetCode: Remove Element
摘要: 简单题, 一次过 1 class Solution { 2 public: 3 int removeElement(int A[], int n, int elem) { 4 // Start typing your C/C++ solution below 5 ... 阅读全文
posted @ 2013-04-20 06:16 ying_vincent 阅读(150) 评论(0) 推荐(0)
LeetCode: Remove Duplicates from Sorted List II
摘要: 忘了边界条件,少数次过 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) :... 阅读全文
posted @ 2013-04-20 06:11 ying_vincent 阅读(180) 评论(0) 推荐(0)
LeetCode: Remove Duplicates from Sorted List
摘要: list比array更简单, 一次过 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(i... 阅读全文
posted @ 2013-04-20 05:08 ying_vincent 阅读(133) 评论(0) 推荐(0)
LeetCode: Remove Duplicates from Sorted Array II
摘要: 在上一题的基础上加了个bool twice,一次过 1 class Solution { 2 public: 3 int removeDuplicates(int A[], int n) { 4 // Start typing your C/C++ solution belo... 阅读全文
posted @ 2013-04-20 05:04 ying_vincent 阅读(122) 评论(0) 推荐(0)
LeetCode: Remove Duplicates from Sorted Array
摘要: 很奇怪这种小问题会多数次过。。太小看他了 1 class Solution { 2 public: 3 int removeDuplicates(int A[], int n) { 4 // Start typing your C/C++ solution below 5 ... 阅读全文
posted @ 2013-04-20 04:56 ying_vincent 阅读(149) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 27 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3