摘要:
https://oj.leetcode.com/problems/populating-next-right-pointers-in-each-node/二叉树遍历的变种:树的节点多了个next指针。首先想到肯定和树的遍历有关:先根、中根、后根都不可以。。。观察找规律,如果当前节点是它根的 left...
阅读全文
posted @ 2014-07-26 21:17
qingcheng奕
阅读(114)
推荐(0)
摘要:
https://oj.leetcode.com/problems/search-a-2d-matrix/具有数据递增性质的一个二维数组,对它进行二分搜索。首先搜索target所在的行,再找列。class Solution {public: bool searchMatrix(vector > ...
阅读全文
posted @ 2014-07-26 20:54
qingcheng奕
阅读(155)
推荐(0)
摘要:
https://oj.leetcode.com/problems/max-points-on-a-line/给n多个二维平面上的点,求其中在同一条直线上点的最大数细节题,也挺考脑力的class Solution {public: int maxPoints(vector &points) { ...
阅读全文
posted @ 2014-07-26 20:20
qingcheng奕
阅读(140)
推荐(0)
摘要:
https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/给一个string,找出其中不含有重复元素的最长子串的长度。class Solution {public: int lengthOfL...
阅读全文
posted @ 2014-07-26 18:35
qingcheng奕
阅读(131)
推荐(0)
摘要:
https://oj.leetcode.com/problems/longest-palindromic-substring/给一个string,求它的最长回文子串。定义一个二维数组bool isPal[1000][1000];记录从 i 到 j 是否为回文的。首先初始化 [i][i] = true...
阅读全文
posted @ 2014-07-26 16:39
qingcheng奕
阅读(87)
推荐(0)