摘要: linked-list-cycle-ii 题目描述 Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull. Follow up: Can you solve it w 阅读全文
posted @ 2016-08-14 13:57 RosenDing 阅读(134) 评论(0) 推荐(0) 编辑
摘要: reorder-list 题目描述 Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the 阅读全文
posted @ 2016-08-14 13:35 RosenDing 阅读(133) 评论(0) 推荐(0) 编辑
摘要: sum-root-to-leaf-numbers 题目描述 Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number. An example is the ro 阅读全文
posted @ 2016-08-13 22:41 RosenDing 阅读(159) 评论(0) 推荐(0) 编辑
摘要: binary-tree-maximum-path-sum binary-tree-maximum-path-sum 题目描述 Given a binary tree, find the maximum path sum. The path may start and end at any node 阅读全文
posted @ 2016-08-13 22:39 RosenDing 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 机器人的运动范围 题目描述 地上有一个m行和n列的方格。一个机器人从坐标0,0的格子开始移动,每一次只能向左,右,上,下四个方向移动一格,但是不能进入行坐标和列坐标的数位之和大于k的格子。 例如,当k为18时,机器人能够进入方格(35,37),因为3+5+3+7 = 18。但是,它不能进入方格(35 阅读全文
posted @ 2016-08-05 20:33 RosenDing 阅读(550) 评论(0) 推荐(0) 编辑
摘要: 矩阵中的路径 题目描述 请设计一个函数,用来判断在一个矩阵中是否存在一条包含某字符串所有字符的路径。路径可以从矩阵中的任意一个格子开始,每一步可以在矩阵中向左,向右,向上,向下移动一个格子。如果一条路径经过了矩阵中的某一个格子,则该路径不能再进入该格子。 例如 a b c e s f c s a d 阅读全文
posted @ 2016-08-05 20:31 RosenDing 阅读(394) 评论(0) 推荐(0) 编辑
摘要: 滑动窗口的最大值 题目描述 给定一个数组和滑动窗口的大小,找出所有滑动窗口里数值的最大值。例如,如果输入数组{2,3,4,2,6,2,5,1}及滑动窗口的大小3,那么一共存在6个滑动窗口,他们的最大值分别为{4,4,6,6,6,5}; 针对数组{2,3,4,2,6,2,5,1}的滑动窗口有以下6个: 阅读全文
posted @ 2016-07-31 10:48 RosenDing 阅读(2925) 评论(0) 推荐(0) 编辑
摘要: 数据流中的中位数 题目描述 如何得到一个数据流中的中位数?如果从数据流中读出奇数个数值,那么中位数就是所有数值排序之后位于中间的数值。如果从数据流中读出偶数个数值,那么中位数就是所有数值排序之后中间两个数的平均值。 思路 代码 阅读全文
posted @ 2016-07-31 10:18 RosenDing 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 二叉搜索树的第k个结点 题目描述 给定一颗二叉搜索树,请找出其中的第k大的结点。例如,5 / \ 3 7 /\ /\ 2 4 6 8 中,按结点数值大小顺序第三个结点的值为4。 思路 代码 阅读全文
posted @ 2016-07-30 23:18 RosenDing 阅读(1541) 评论(0) 推荐(0) 编辑
摘要: 序列化二叉树 题目描述 请实现两个函数,分别用来序列化和反序列化二叉树 思路 代码 阅读全文
posted @ 2016-07-30 22:39 RosenDing 阅读(211) 评论(0) 推荐(0) 编辑