会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Walker-Lee
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
下一页
2015年11月26日
LeetCode 58 Length of Last Word
摘要: LeetCode 58 Length of Last Wordint lengthOfLastWord(char* s) { int length=0,falg=0; int n=strlen(s); if(n=1;i--) { if(falg==1 && s[...
阅读全文
posted @ 2015-11-26 15:47 Walker_Lee
阅读(115)
评论(0)
推荐(0)
2015年11月25日
LeetCode 26 Remove Duplicates from Sorted Array
摘要: LeetCode 26 Remove Duplicates from Sorted Array与27题类似 http://www.cnblogs.com/walker-lee/p/4994950.htmlint removeDuplicates(int* nums, int numsSize) { ...
阅读全文
posted @ 2015-11-25 16:06 Walker_Lee
阅读(132)
评论(0)
推荐(0)
LeetCode 27 Remove Element
摘要: LeetCode 27 Remove ElementC语言实现:相当于新设置了一个指针n,仍用原有的存储空间,存放值不等于val的elementint removeElement(int* nums, int numsSize, int val) { int n=0; for(int i...
阅读全文
posted @ 2015-11-25 15:58 Walker_Lee
阅读(426)
评论(0)
推荐(0)
2015年11月23日
LeetCode 21 Merge Two Sorted Lists
摘要: LeetCode 21 Merge Two Sorted Lists/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */stru...
阅读全文
posted @ 2015-11-23 10:25 Walker_Lee
阅读(107)
评论(0)
推荐(0)
LeetCode 232 Implement Queue using Stacks
摘要: LeetCode 232 Implement Queue using Stacksclass Queue { stack input, output;public: void push(int x) { input.push(x); } void pop(voi...
阅读全文
posted @ 2015-11-23 09:22 Walker_Lee
阅读(107)
评论(0)
推荐(0)
2015年11月19日
LeetCode 202 Happy Number
摘要: LeetCode 202 Happy Number主要用到了 如果循环里存在4则unhappybool isHappy(int n) { if(n==1) return true; if(n==4) return false; int sum=0; ...
阅读全文
posted @ 2015-11-19 09:31 Walker_Lee
阅读(136)
评论(0)
推荐(0)
2015年11月18日
LeetCode 263 Ugly Number
摘要: LeetCode 263 Ugly Number很多人出现Time Limit Exceeded的情况,是由于没有判断num是否等于0.bool isUgly(int num) { if(num==0) return false; while(num%2 == 0) ...
阅读全文
posted @ 2015-11-18 16:43 Walker_Lee
阅读(141)
评论(0)
推荐(0)
2015年11月17日
LeetCode 83 Remove Duplicates from Sorted List
摘要: LeetCode 83 Remove Duplicates from Sorted List/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next;...
阅读全文
posted @ 2015-11-17 10:24 Walker_Lee
阅读(114)
评论(0)
推荐(0)
LeetCode 70 Climbing Stairs
摘要: LeetCode 70 Climbing Stairs使用递归方法,超时int climbStairs(int n) { if(n=2)int climbStairs(int n) { if (n == 0 || n == 1) return 1; int pre = 1...
阅读全文
posted @ 2015-11-17 09:53 Walker_Lee
阅读(119)
评论(0)
推荐(0)
LeetCode 206 Reverse Linked List
摘要: LeetCode 206 Reverse Linked List递归:/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */str...
阅读全文
posted @ 2015-11-17 09:22 Walker_Lee
阅读(124)
评论(0)
推荐(0)
上一页
1
2
3
4
下一页
公告