04 2018 档案
LeetCode 21 合并两个有序链表
摘要:我的 最快的: 原来是注释里的,我改成了if。和我写的一样快。都是12ms。但是原提交却是8ms…… 我写得长,因为res->为NULL,没想到可以return preHead.next,学到了。 阅读全文
posted @ 2018-04-29 16:54 苛性氢 阅读(115) 评论(0) 推荐(0)
leetcode 206 反转链表
摘要:不会。 递归。有点慢,18ms。 来源:https://blog.csdn.net/geekmanong/article/details/51097196 最快的。7ms? 阅读全文
posted @ 2018-04-28 23:23 苛性氢 阅读(136) 评论(0) 推荐(0)
leetcode 8 字符串转整数
摘要:击败30%。 然后我今天又交了一次,没过。 " 0000000000012345678" 别人的代码: 来自:http://www.cnblogs.com/grandyang/p/4125537.html 阅读全文
posted @ 2018-04-28 19:58 苛性氢 阅读(193) 评论(0) 推荐(0)
LeetCode14 最长公共前缀
摘要:我的代码:(4ms) 改正之后的代码:先找出一个最短的。 class Solution { public: string longestCommonPrefix(vector<string>& strs) { string res=""; if(strs.empty()){ return res; 阅读全文
posted @ 2018-04-20 08:41 苛性氢 阅读(115) 评论(0) 推荐(0)
LeetCode38 报数
摘要:/* C++ string内部似乎还是char数组?末尾是'\0',str[length()]不会抛异常。 */ 我的代码: 最快代码: 阅读全文
posted @ 2018-04-19 22:37 苛性氢 阅读(722) 评论(0) 推荐(0)
LeetCode125 验证回文字符串
摘要: 阅读全文
posted @ 2018-04-19 11:40 苛性氢 阅读(150) 评论(0) 推荐(0)
LeetCode 242 有效的字母异位词
摘要:不同的字母数是否相等。 阅读全文
posted @ 2018-04-19 10:51 苛性氢 阅读(136) 评论(0) 推荐(0)
LeetCode7 反转整数
摘要:我的代码: 一开始24ms,加了关闭同步后12ms。超越96%的代码。 别人的代码: 5ms。 阅读全文
posted @ 2018-04-19 10:49 苛性氢 阅读(115) 评论(0) 推荐(0)
LeetCode 28 实现strStr()
摘要:我的方法:直接调用C++的方法。 别人: for i: 阅读全文
posted @ 2018-04-04 20:17 苛性氢 阅读(122) 评论(0) 推荐(0)
LeetCode 387 字符串中的第一个唯一字符
摘要:一开始用 int *p=new int[256]; memset(p,0,sizeof(p)); 没过,很迷. 后来发现sizeof(p)==4 但是未过样例是61. 62*4=…… 其他人的答案: 阅读全文
posted @ 2018-04-01 17:16 苛性氢 阅读(219) 评论(0) 推荐(0)
LeetCode 344 反转字符串
摘要:原来C++ 的 string 是可以修改的…… 阅读全文
posted @ 2018-04-01 16:26 苛性氢 阅读(159) 评论(0) 推荐(0)
leetcode 36 有效的数独
摘要:参考: https://blog.csdn.net/mine_song/article/details/70207326 阅读全文
posted @ 2018-04-01 16:25 苛性氢 阅读(108) 评论(0) 推荐(0)