堆栈
iyangdi
这个作者很懒,什么都没留下…
展开
-
Google/LinkCode:E-有效的括号序列
题目题目来源:Link给定一个字符串所表示的括号序列,包含以下字符: '(', ')', '{', '}', '[' and ']', 判定是否是有效的括号序列。您在真实的面试中是否遇到过这个题? Yes样例括号必须依照 "()" 顺序表示, "()[]{}" 是有效的括号,但 "([)]"则是无效的括原创 2017-08-10 13:35:34 · 304 阅读 · 0 评论 -
LintCode:M-K个最近的点
LintCode链接给定一些 points 和一个 origin,从 points 中找到 k 个离 origin 最近的点。按照距离由小到大返回。如果两个点有相同距离,则按照x值来排序;若x值也相同,就再按照y值排序。您在真实的面试中是否遇到过这个题? Yes样例给出 points = [[4,6],[4,7],[4,4],[2原创 2017-08-30 14:01:50 · 999 阅读 · 0 评论 -
LintCode:M-最大正方形
LintCode链接在一个二维01矩阵中找到全为1的最大正方形您在真实的面试中是否遇到过这个题? Yes样例1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0返回 4分析(1)方法一:一般性方法,可以扩展到最大矩形计算1、以每一行为矩形底,计算每一列的含原创 2017-08-30 11:05:11 · 315 阅读 · 0 评论 -
LintCode:M-最小子串覆盖
给定一个字符串source和一个目标字符串target,在字符串source中找到包括所有目标字符串字母的子串。 注意事项如果在source中没有这样的子串,返回"",如果有多个这样的子串,返回起始位置最小的子串。您在真实的面试中是否遇到过这个题? Yes说明在答案的子串中的字母在目标字符串中是否需要具有相同的顺序?原创 2017-08-28 20:41:31 · 857 阅读 · 0 评论 -
LintCode:M-逆波兰表达式求值
LintCode链接求逆波兰表达式的值。在逆波兰表达法中,其有效的运算符号包括 +, -, *, / 。每个运算对象可以是整数,也可以是另一个逆波兰计数表达。您在真实的面试中是否遇到过这个题? Yes样例["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9["4", "13",原创 2017-08-28 12:27:25 · 207 阅读 · 0 评论 -
LintCode:H-Sliding Window Median
LintCode:LinkGiven an array of n integer, and a moving window(size k), move the window at each iteration from the start of the array, find the median of the element inside the window at ea原创 2017-08-24 19:42:50 · 200 阅读 · 0 评论 -
Google算法题:M-求二叉搜索树的第K小的数
http://www.jiuzhang.com/article/Google%202016%E5%B9%B412%E6%9C%88SDE%E7%94%B5%E9%9D%A2%E9%9D%A2%E7%BB%8F/给出一个二叉搜索树,写出一个方法,求出树中的第k小的数//中序遍历-递归int k;public int findTheKth(TreeNode root原创 2017-08-21 11:02:09 · 587 阅读 · 0 评论 -
Google算法题:H-最大矩形
题目http://www.lintcode.com/zh-cn/problem/maximal-rectangle/#http://www.jiuzhang.com/article/Google%202017%E5%B9%B41%E6%9C%88%E6%A0%A1%E6%8B%9B%20software%20engineer%20onsite%E9%9D%A2%E7%B原创 2017-08-21 09:22:04 · 772 阅读 · 0 评论 -
Google/LintCode:M-带最小值操作的栈
题目题目来源:Link实现一个带有取最小值min方法的栈,min方法将返回当前栈中的最小值。你实现的栈将支持push,pop 和 min 操作,所有操作要求都在O(1)时间内完成。 注意事项如果堆栈中没有数字则不能进行min方法的调用您在真实的面试中是否遇到过这个题? Yes样例原创 2017-08-11 15:43:34 · 301 阅读 · 0 评论 -
Google算法题:132模式
题目Given a sequence of n integers a1, a2, ..., an, a 132pattern is a subsequence ai, aj, ak such that i j kand ai ak aj. Design an algorithm that takes a list of n numbers as input and原创 2017-08-18 15:00:17 · 1637 阅读 · 1 评论 -
LintCode:M-Expression Expand
LintCode链接Given an expression s includes numbers, letters and brackets. Number represents the number of repetitions inside the brackets(can be a string or another expression).Please expand exp原创 2017-08-30 15:21:02 · 262 阅读 · 0 评论