自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 [lintcode]880. Construct Binary Tree from String

链接:http://www.lintcode.com/zh-cn/problem/construct-binary-tree-from-string/You need to construct a binary tree from a string consisting of parenthesis and integers.The whole input represents

2018-03-26 16:27:34 300

原创 [lintcode]878. Boundary of Binary Tree

链接:http://www.lintcode.com/zh-cn/problem/boundary-of-binary-tree/Given a binary tree, return the values of its boundary in anti-clockwise direction starting from root. Boundary includes left b

2018-03-26 16:00:19 323

原创 [lintcode]717. Tree Longest Path With Same Value

链接:http://www.lintcode.com/zh-cn/problem/tree-longest-path-with-same-value/假设有一棵有 N 个节点的无向树, 编号为 1 到 N, 每一个节点都有一个int类型的值,不同的节点可以有相同的值。给一个长度为N的数组A,A[j]表示第j + 1个节点的值。再给一个长度为 (N - 1) * 2 的数组 

2018-03-26 15:27:32 523

原创 [lintcode]88. 最近公共祖先

链接:http://www.lintcode.com/zh-cn/problem/lowest-common-ancestor/给定一棵二叉树,找到两个节点的最近公共父节点(LCA)。最近公共祖先是两个节点的公共的祖先节点且具有最大深度。 注意事项假设给出的两个节点都在树中存在您在真实的面试中是否遇到过这个题? Yes

2018-03-26 14:11:18 295

原创 [lintcode]二叉树最大深度和最小深度

二叉树最大深度如果二叉树为空,则深度为0 如果不为空,分别求左子树的深度和右子树的深度,去最大的再加1,因为根节点深度是1,要加进去。class Solution {public: /** * @param root: The root of binary tree. * @return: An integer */

2018-03-25 18:38:05 208

原创 [lintcode]909. Android Unlock Patterns

链接:http://www.lintcode.com/zh-cn/problem/android-unlock-patterns/Given an Android 3x3 key lock screen and two integers m and n, where 1 ≤ m ≤ n ≤ 9, count the total number of unlock pa

2018-03-24 20:33:30 415

原创 [lintcode]889. Sentence Screen Fitting

链接:http://www.lintcode.com/zh-cn/problem/sentence-screen-fitting/  Given a rows x cols screen and a sentence represented by a list of non-empty words, find how many times the given sentence can ...

2018-03-24 18:55:00 344

原创 [lintcode]867. 4 Keys Keyboard

链接:http://www.lintcode.com/zh-cn/problem/4-keys-keyboard/Imagine you have a special keyboard with the following keys:Key 1: (A): Print one 'A' on screen.Key 2: (Ctrl-A): Select the who

2018-03-24 17:18:11 299

原创 [lintcode]843. 数字翻转

链接:http://www.lintcode.com/zh-cn/problem/digital-flip/给你一个01构成的数组。请你找出最小翻转步数,使得数组满足以下规则:1的后面可以是1或者0,但是0的后面必须是0。 注意事项输入的数组长度n 。您在真实的面试中是否遇到过这个题? Yes样例

2018-03-24 16:41:29 694

原创 [lintcode]752. 流浪剑客斯温

链接:http://www.lintcode.com/zh-cn/problem/rogue-knight-sven/在物质位面“现实”中,有n+1个星球,分别为星球0,星球1,……,星球n。每一个星球都有一个传送门,通过传送门可以直接到达目标星球而不经过其他的星球。不过传送门有两个缺点。第一,从星球i通过传送门只能到达编号比i大,且与i的差不超过limit的星球。

2018-03-24 16:02:27 418

原创 [lintcode]741. Calculate Maximum Value II

链接:http://www.lintcode.com/zh-cn/problem/calculate-maximum-value-ii/Given a string of numbers, write a function to find the maximum value from the string, you can add a + or * sign between any t

2018-03-24 15:28:48 188

原创 [lintcode]740. 零钱兑换II

链接:http://www.lintcode.com/zh-cn/problem/coin-change-ii/#给出不同面值的硬币以及总金额. 试写一函数来计算构成该总额的组合数量. 你可以假设每一种硬币你都有无限个.class Solution {public: /** * @param amount: a total amount of money

2018-03-24 15:01:31 796

原创 [lintcode]118. 不同的子序列

链接:http://www.lintcode.com/zh-cn/problem/distinct-subsequences/给出字符串S和字符串T,计算S的不同的子序列中T出现的个数。子序列字符串是原始字符串通过删除一些(或零个)产生的一个新的字符串,并且对剩下的字符的相对位置没有影响。(比如,“ACE”是“ABCDE”的子序列字符串,而“AEC”不是)。您在真实的面试中是否遇到过这个题?Y...

2018-03-20 14:54:37 815 1

原创 [lintcode]108. 分割回文串 II

链接:http://www.lintcode.com/zh-cn/problem/palindrome-partitioning-ii/  给定一个字符串s,将s分割成一些子串,使每个子串都是回文。返回s符合要求的的最少分割次数。您在真实的面试中是否遇到过这个题?Yes样例比如,给出字符串s = "aab",返回 1, 因为进行一次分割可以将字符串s分割成["a...

2018-03-20 12:52:36 247

原创 [lintcode]91. 最小调整代价

链接:http://www.lintcode.com/zh-cn/problem/minimum-adjustment-cost/Given an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given number...

2018-03-19 16:42:22 464

原创 [lintcode]29. 交叉字符串

链接:http://www.lintcode.com/zh-cn/problem/interleaving-string/  给出三个字符串:s1、s2、s3,判断s3是否由s1和s2交叉构成。 您在真实的面试中是否遇到过这个题? Yes样例比如 s1 = "aabcc" s2 = "dbbca"    - 当 s3 = "aadbbcbcac",返回  tru...

2018-03-19 16:40:31 291

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除