由买买提看人间百态

topics

全部话题 - 话题: leetcode
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
l*********8
发帖数: 4642
1
来自主题: JobHunting版 - leetcode, 给您的网站提点建议
我的观点:
(1) 可以调当然更好,不能也无所谓。 leetcode界面现在可以容纳30行代码(把注
释删掉),差不多是面试代码的合适长度。 如果一个代码写到六七十行,很可能思路
错了,在面试的时候也无法写完的。
(2) 这个无所谓。
(3) 有时候是不方便看。不过本来就是要减少对编译器和debug tool的依赖。
(4) 快速解决方法: 按F11全屏.
H****r
发帖数: 2801
2
来自主题: JobHunting版 - 准备好好做做leetcode上的题
BSO...
呼唤leetcode加难题!
p*****2
发帖数: 21240
3
来自主题: JobHunting版 - 准备好好做做leetcode上的题
另外就是基本没有BFS的题。Tree的题现在也还不支持。
下一步就是看leetcode的blog练习tree的题目。希望这个星期能搞完。
t**********h
发帖数: 2273
4
膜拜牛人leetcode都做完了?
g*********e
发帖数: 14401
5
来自主题: JobHunting版 - leetcode上的3sum
估计你的runtime太长了,leetcode表示无法接受。
h****e
发帖数: 928
e***a
发帖数: 1661
7
来自主题: JobHunting版 - request solutions to 2 questions on leetcode
Nobody can solve these 2 leetcode questions?
p*****2
发帖数: 21240
8
来自主题: JobHunting版 - request solutions to 2 questions on leetcode

我觉得这题面试的时候递归应该就不错了。不过没有霸气了。像viisa, zhangchi肯定
是霸气十足的bottom up。 这题leetcode 仔细研究过bottom up说还可以。不过我还没
想过。现在没有G和F的面试,也没动力搞难题了。
e***a
发帖数: 1661
9
来自主题: JobHunting版 - request solutions to 2 questions on leetcode
Nobody can solve these 2 leetcode questions?
p*****2
发帖数: 21240
10
来自主题: JobHunting版 - request solutions to 2 questions on leetcode

我觉得这题面试的时候递归应该就不错了。不过没有霸气了。像viisa, zhangchi肯定
是霸气十足的bottom up。 这题leetcode 仔细研究过bottom up说还可以。不过我还没
想过。现在没有G和F的面试,也没动力搞难题了。
S****h
发帖数: 115
11
Given an array of non-negative integers, you are initially positioned at the
first index of the array.
Each element in the array represents your maximum jump length at that
position.
Your goal is to reach the last index in the minimum number of jumps.
For example:
Given array A = [2,3,1,1,4]
The minimum number of jumps to reach the last index is 2. (Jump 1 step from
index 0 to 1, then 3 steps to the last index.)
我就按照最短路径的解法来做,初始化所有mj[A.length](minimum jump)为Integer.
MAX_VALUE, 然后mj[0] = 0; 后面利用P... 阅读全帖
h****e
发帖数: 928
12
来自主题: JobHunting版 - Leetcode Timeout
暴力是不行的,一定要有一些优化。你可以就return false看
LeetCode的测试数据是什么,然后一个个试过去。你肯定会
找到至少对于一个测试数据你的程序要运行>>1分钟的。打印出
一些调试信息你就可以知道为什么哪里运行慢了。
z********n
发帖数: 6
13
来自主题: JobHunting版 - leetcode一道题
有O(n2)的算法
leetcode上Largest Rectangle in Histogram这道题有O(n)的算法,对这个矩阵每行这
么计算一下就可以了。
d******i
发帖数: 76
14
来自主题: JobHunting版 - leetcode一道题
这道题可以和leetcode上largest Rectangle那道题的解决方式结合起来
largest Rectangle的解法如下
http://tech-queries.blogspot.com/2011/03/maximum-area-rectangle
结合这个解法,遍历每一行,找到max
v********d
发帖数: 36
15
来自主题: JobHunting版 - Leetcode: First Missing Positive
leetcode 上面的算法就已经很好了吧?
已经是O(n)了,难道有比O(N)更好的?
h****7
发帖数: 93
16
来自主题: JobHunting版 - Leetcode: First Missing Positive
leetcode 上面的算法在哪里?我怎么没有找到呀。 [挠头]
请指点。多谢!
v********d
发帖数: 36
17
来自主题: JobHunting版 - Leetcode: First Missing Positive
leetcode 上面的算法就已经很好了吧?
已经是O(n)了,难道有比O(N)更好的?
h****7
发帖数: 93
18
来自主题: JobHunting版 - Leetcode: First Missing Positive
leetcode 上面的算法在哪里?我怎么没有找到呀。 [挠头]
请指点。多谢!
j*****n
发帖数: 1545
19
来自主题: JobHunting版 - 问道leetcode上的题
http://www.leetcode.com/2010/11/best-time-to-buy-and-sell-stock
下面有人给了个新问题:
if you can keep buying and selling, how to maximize the profit? for example,
if it is 6,1,3,2,4,7, we can buy for 1 and sell for 3, and we can buy for 2
, and sell for 4,then buy on 4, sell for 7. total maxval =3-1+4-2+7-4 = 7.
They would like to have some O(n) solutions.
t**i
发帖数: 314
20
来自主题: JobHunting版 - leetcode上遇到的问题
我对比了我的运行情况和这位的答案 http://dl.dropbox.com/u/19732851/LeetCode/ReadMe.html
他用的是c++,我用java,运行时间比他的长好多啊,java有慢这么多吗?
h****e
发帖数: 928
21
来自主题: JobHunting版 - leetcode上遇到的问题
虽然说return null是可以,但是LeetCode可能想让你养成
写好code的习惯吧,你应该返回empty arrays or collections,
这样可以避免caller一个extra null check。具体原因你可以
看Effective Java第二版的Item 43: Return empty arrays
or collections, not nulls。
D****3
发帖数: 611
22
你是做完了leetcode的online judge还是什么
g*********e
发帖数: 14401
23
回顾一遍careercup,然后扫一遍geekforgeeks,然后再一遍Leetcode。同时开始投简
历,GAFLM统统搞起。然后大满贯,然后一一据之,然后回来贴面经 贴offer,然后联
系俞敏洪,开新东方北美码农分校。
j*******e
发帖数: 1058
24
你是做了online judge么?还是leetcode的其他什么?请详细说说,我也在准备呢。
s********e
发帖数: 340
25
来自主题: JobHunting版 - leetcode 是什么?求下载链接!
leetcode 是什么?求下载链接!
好像是面试题,哪里有下载啊,我找不到。谢谢!
l*m
发帖数: 1048
26
来自主题: JobHunting版 - leetcode 是什么?求下载链接!
Google 了一下,
http://www.leetcode.com/
不过现在暂时上不了,
t**********h
发帖数: 2273
27
哥看好你,赶紧的。先把leetcode翻译一遍吧,帮助下我们这些英文残疾人
l*m
发帖数: 1048
28
这个方法好,就从翻译leetcode开始,
g*********e
发帖数: 14401
29
强烈支持楼主!
leetcode都给烙印占便宜了
l*****s
发帖数: 279
30
Is leetcode down today? I got 403 error
l*****s
发帖数: 279
31
Is leetcode down today? I got 403 error
h****n
发帖数: 1093
32
支持,看到很多同胞面试被老印整,不能便宜了老印
希望Leetcode本人考虑一下这个事
S*******w
发帖数: 24236
33
大家可以考虑给leetcode捐钱
然后让他只提供服务给中国人
t**********h
发帖数: 2273
34
我觉得应该尊重leetcode自己的决定。但就interview的英文扯蛋(communication)
来说,和做题库用的是中文题库还是英文题库区别不大

f*********m
发帖数: 726
35
Print All Combinations of a Number as a Sum of Candidate Numbers
http://www.leetcode.com/2010/09/print-all-combinations-of-number-as-sum.html
原文如下,稍作修改(把target 从7该为9):
“To search for all combination, we use a backtracking algorithm. Here, we
use the above example of candidate={2,3,6,7} and target=9.
First, we start with a sum of 0. Then, we iterate over all possibilities
that can be added to sum, which yields the possible set of sum={2,3,6,7}.
Assume now that sum=2, we continue adding all poss... 阅读全帖
f*********m
发帖数: 726
36
这道题需要排序吗?leetocode中说不需要(http://www.leetcode.com/2010/09/print-all-combinations-of-number-as-sum.html
f*********m
发帖数: 726
37
A robot is located at the top-left corner of a m x n grid (marked ‘Start’
in the diagram below). The robot can only move either down or right at any
point in time. The robot is trying to reach the bottom-right corner of the
grid (marked ‘Finish’ in the diagram below). How many possible unique
paths are there?
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths
would there be?
An obstacle and empty space is marked as 1 and 0 respectively in t... 阅读全帖
b***d
发帖数: 87
38
来自主题: JobHunting版 - 请教一道leetcode的online judge题
请教一道leetcode的online judge题,题目一直没看懂。
Given an absolute path for a file (Unix-style), simplify it.
For example,
path = "/home/", => "/home"
path = "/a/./b/../../c/", => "/c"
另外还有几个列子:
/home/foo/../bar" -> "/home/bar"
"/home/foo/./.././bar" -> "/home/bar"
"/home/of/foo/../../bar/../../is/./here/." -> "/is/here"
l*********8
发帖数: 4642
39
来自主题: JobHunting版 - 为啥leetcode上time limit exceeded
“程序有问题,比如死循环或者跳不出来,还是算法不好?”
都有可能。
可以吧leetcode上的数据拿来本机跑一下。
r*******b
发帖数: 78
40
来自主题: JobHunting版 - 请版上大牛推荐类似LeetCode的网站
小弟想做coding,找了半天,只发现LeetCode很不错,既有面试题目,又有online
test
不知道版上大牛能否推荐一些类似网站?
找到工作立刻发包子,多谢!
p*****2
发帖数: 21240
41
来自主题: JobHunting版 - 请版上大牛推荐类似LeetCode的网站
leetcode上边的题做完了就差不多了。
h****e
发帖数: 928
42
来自主题: JobHunting版 - 请版上大牛推荐类似LeetCode的网站
是的,leetcode上的题目和文章看和做一两遍就要花不少
时间了吧。
其它网站虽然没有online judge,但是能给出解法参考
作用也很大,例如:
http://www.stackoverflow.com/ (用关键词过滤)
http://www.geeksforgeeks.org/
http://www.careercup.com/
不过这些就是汪洋题海了。
w****x
发帖数: 2483
43
来自主题: JobHunting版 - 请版上大牛推荐类似LeetCode的网站
leetcode上的什么Google code jam之类的我都直接跳过了
b*********n
发帖数: 1258
44
来自主题: JobHunting版 - Leetcode 问题
http://dl.dropbox.com/u/19732851/LeetCode/RemoveNthNodeFromEndo
*remove = (*remove)->next;
这个可以把linked list里面,自己所在节点删除吗?
好像不行吧
C***U
发帖数: 2406
45
来自主题: JobHunting版 - LeetCode Scramble String 疑问
最近问这个题目的人不少啊。。。
leetcode上有解答么?
n****r
发帖数: 120
46
leetcode 过不去,你应该可以看到哪些case fail了,一般来说是自己的程序没有
cover哪些case,在自己机器上跑跑哪些case,改过了再继续tryleetcode
e******o
发帖数: 757
47
来自主题: JobHunting版 - 求leetcode 4sum的O(n^2)解法
我记得leetcode里面要求每个组合是unique的。
如果用hashtable 的话
如果两个two_sum 是 (-2, -1); (1, 2);
那么 (-2, 1); (-1, 2)的和也是0;
然而这个重复了。
我看到的做好的是 O(N^2 logn)
e******o
发帖数: 757
48
来自主题: JobHunting版 - 求leetcode 4sum的O(n^2)解法
我记得leetcode里面要求每个组合是unique的。
如果用hashtable 的话
如果两个two_sum 是 (-2, -1); (1, 2);
那么 (-2, 1); (-1, 2)的和也是0;
然而这个重复了。
我看到的做好的是 O(N^2 logn)
T****U
发帖数: 3344
49
跟3sum一样,搜leetcode 3sum
n****r
发帖数: 471
50
来自主题: JobHunting版 - 请教leetcode Permutations II 解法和code
谁能给讲解一下这位大牛的解法? http://discuss.leetcode.com/questions/225/permutations-ii
Code:
class Solution {
public:
vector > permuteUnique(vector &num) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
vector used(num.size(), false);
vector path;
vector > ret;
sort(num.begin(), num.end());
sub(num, used, path, ret);
return ret;
}
void sub(vector &num, vector... 阅读全帖
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)