上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页

2014年12月20日

摘要: Majority Number 原题链接:http://lintcode.com/en/problem/majority-number/#Given an array of integers, the majority number is the number that occurs more th... 阅读全文
posted @ 2014-12-20 07:58 Yu's Garden 阅读(3446) 评论(0) 推荐(0) 编辑

2014年12月19日

摘要: Fast Power 原题链接:http://lintcode.com/en/problem/fast-power/#Calculate the an% b where a, b and n are all 32bit integers.ExampleFor 231 % 3 = 2For 10010... 阅读全文
posted @ 2014-12-19 22:08 Yu's Garden 阅读(5024) 评论(0) 推荐(1) 编辑
摘要: Pow(x, n) Implement pow(x, n).SOLUTION 1:使用二分法。1. 负数的情况,使用以下的公式转化为求正数power,另外,考虑到MIN_VALUE可能会造成越界的情况,我们先将负数+1:X^(-n) = X^(n + 1) * XX^n = 1/(x^(-n))2.... 阅读全文
posted @ 2014-12-19 20:29 Yu's Garden 阅读(2321) 评论(0) 推荐(0) 编辑
摘要: Minimum Subarray原题链接: http://lintcode.com/zh-cn/problem/minimum-subarray/#Given an array of integers, find the subarray with smallest sum.Return the s... 阅读全文
posted @ 2014-12-19 18:26 Yu's Garden 阅读(641) 评论(0) 推荐(0) 编辑
摘要: Subarray Sum 原题链接:http://lintcode.com/zh-cn/problem/subarray-sum/#Given an integer array, find a subarray where the sum of numbers is zero. Your code ... 阅读全文
posted @ 2014-12-19 18:01 Yu's Garden 阅读(3698) 评论(1) 推荐(0) 编辑

2014年12月18日

摘要: Minimum Depth of Binary TreeGiven a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root... 阅读全文
posted @ 2014-12-18 22:59 Yu's Garden 阅读(565) 评论(0) 推荐(0) 编辑
摘要: Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the be... 阅读全文
posted @ 2014-12-18 22:31 Yu's Garden 阅读(4666) 评论(0) 推荐(0) 编辑
摘要: Binary Tree Postorder Traversal Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ ... 阅读全文
posted @ 2014-12-18 21:51 Yu's Garden 阅读(519) 评论(0) 推荐(0) 编辑
摘要: Sum Root to Leaf Numbers Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-t... 阅读全文
posted @ 2014-12-18 21:27 Yu's Garden 阅读(623) 评论(0) 推荐(0) 编辑
摘要: Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the give... 阅读全文
posted @ 2014-12-18 21:10 Yu's Garden 阅读(525) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页

导航