上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 23 下一页
摘要: 原题地址基本模拟题代码:1 bool isSameTree(TreeNode *p, TreeNode *q) {2 if (p && q)3 return p->val == q->val && isSameTree(p->left, q->left) &&... 阅读全文
posted @ 2015-02-02 10:55 李舜阳 阅读(134) 评论(0) 推荐(0)
摘要: 原题地址基本模拟题代码: 1 int removeDuplicates(int A[], int n) { 2 if (n <= 0) 3 return 0; 4 5 int i = 1; 6 int ... 阅读全文
posted @ 2015-02-02 10:51 李舜阳 阅读(128) 评论(0) 推荐(0)
摘要: 原题地址基本模拟题,双指针法代码: 1 int removeElement(int A[], int n, int elem) { 2 int i = 0; 3 int j = 0; 4 5 while (i < n) { 6 ... 阅读全文
posted @ 2015-02-02 10:47 李舜阳 阅读(135) 评论(0) 推荐(0)
摘要: 原题地址基本模拟,记得最后把尾节点next置为NULL...代码: 1 ListNode *deleteDuplicates(ListNode *head) { 2 ListNode *h = NULL; 3 ListNode *t = NULL; 4 ... 阅读全文
posted @ 2015-02-02 10:42 李舜阳 阅读(135) 评论(0) 推荐(0)
摘要: 原题地址基本动归题可以压缩状态空间代码: 1 int climbStairs(int n) { 2 if (n <= 0) 3 return 0; 4 5 int count = 1; 6 int tm... 阅读全文
posted @ 2015-02-02 10:33 李舜阳 阅读(149) 评论(0) 推荐(0)
摘要: 原题地址简单模拟代码: 1 vector plusOne(vector &digits) { 2 vector sum(digits.size(), 0); 3 int carry = 1; 4 5 for (int i = digi... 阅读全文
posted @ 2015-02-02 10:19 李舜阳 阅读(197) 评论(0) 推荐(0)
摘要: 原题地址按照数独规则判断即可代码: 1 bool isValidSudoku(vector > &board) { 2 unordered_set record; 3 4 for (int i = 0; i < 9; i++) { 5 ... 阅读全文
posted @ 2015-02-02 10:10 李舜阳 阅读(172) 评论(0) 推荐(0)
摘要: 原题地址简单模拟题代码: 1 string addBinary(string a, string b) { 2 int i = a.length() - 1; 3 int j = b.length() - 1; 4 int carry = 0; 5 ... 阅读全文
posted @ 2015-02-02 09:43 李舜阳 阅读(155) 评论(0) 推荐(0)
摘要: 原题地址链表归并排序的一个小函数代码: 1 ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { 2 ListNode *h = NULL; 3 ListNode *t = NULL; 4 5 ... 阅读全文
posted @ 2015-02-02 09:28 李舜阳 阅读(115) 评论(0) 推荐(0)
摘要: 原题地址简单模拟题代码: 1 int lengthOfLastWord(const char *s) { 2 char prev = ' '; 3 int length = 0; 4 5 while (*s) { 6 ... 阅读全文
posted @ 2015-02-02 09:23 李舜阳 阅读(155) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 23 下一页