由买买提看人间百态

topics

全部话题 - 话题: leetcode
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
b*2
发帖数: 94
1
来自主题: JobHunting版 - 个人觉得leetcode还是原版的好啊
LeetCode在Facebook上投票,
Should LeetCode be revert back to the old blog format instead of the new
format? Please vote.
=.=}}}
d****o
发帖数: 1055
2
你要看别人的代码。网上多得是,一搜一大把。150题,还有leetcode的blog,都是代
码。
leetcode的OJ题自己写才有提高,很多题都是。
f*****7
发帖数: 92
3
同意lz
这才是系统的training
不过不好通关
也不能说leetcode之流
毕竟需求不同
usaco是给acmer入门的
leetcode已经满足了大部分找工的算法需求
总之,各取所需
l**b
发帖数: 457
4
来自主题: JobHunting版 - leetcode被ban掉了
You have tried to access a web page which is in violation of your internet
usage policy.
URL: leetcode.com/onlinejudge
Category: Advertising
To have the rating of this web page re-evaluated please contact your help
desk.
以后上班不能写leetcode了?倒霉。
l**b
发帖数: 457
5
来自主题: JobHunting版 - leetcode被ban掉了
和leetcode没关系,主要是我们公司所谓的SB的policy,直接把leetcode归到AD那边了
。太无奈了。
z*****e
发帖数: 231
6
来自主题: JobHunting版 - leetcode 改版了?
我记得以前在leetcode首页上,leetcode写的文章有8页,今天一看只有4页了,是文章
减少了吗,还是每页的文章多了?
a******e
发帖数: 710
7
来自主题: JobHunting版 - 请大家说说用leetcode的经验
leetcode的discuss区

刚刚开始用leetcode,还不是很熟悉,请问online judge里的题有答案或相关讨论么?
i**c
发帖数: 753
8
来自主题: JobHunting版 - leetcode和geeksforgeeks
感觉leetcode是中国人为主,而geeksforgeeks是老印为主。leetcode质量要高很多啊
S*******w
发帖数: 24236
9
leetcode owner愿意你也不好说啥啊
你要是有心 自己做个纯汉语的。

leetcode
s****0
发帖数: 117
10
check the bottom of this page:
http://www.alexa.com/siteinfo/leetcode.com
Visitors by Country for Leetcode.com
Country Percent of Visitors
India 43.6%
United States 33.1%
Canada 4.1%
Looks like you are helping A3s, directly or indirectly.
g**e
发帖数: 6127
11
leetcode是世界的,你这么看是有点狭隘了
一代宗师里说的好,过了山,眼界就开阔了。

leetcode
m******s
发帖数: 165
12
leetcode给我省了不少事。。。要不然我还准备自己写个本地的简单OJ。。。

leetcode
s******c
发帖数: 99
13
来自主题: JobHunting版 - Leetcode答案哪里找?
leetcode网站上有个discuss的专栏,点那个按钮进去就行了。很多答案是leetcode本
人给的,也有些网友给的答案很好
b*******l
发帖数: 590
14
时间有限,大家觉得主要看哪个网站比较好?
另外大家在leetcode上主要看哪个版面?是Interview Questions Online Judge吗?
多谢了。
c*****r
发帖数: 108
15
来自主题: JobHunting版 - 问一个leetcode上面binary tree的题目
最近打算开始做leetcode了。
做到determine a binary tree is balanced 这道题的时候,发现online judge可能少
考虑了一种情况。(另外这个题目在crack上面有,4th edition 2010版本上的答案明显
错的。新的版本我没看过。)
下面是我看到leetcode论坛上的一段code(是错的), 然而online judge pass了:
public class Solution {
public boolean isBalanced(TreeNode root) {
return height(root) != -1;
}
private int height(TreeNode root)
{
if(root == null)
return 0;
int leftHeight = height(root.left);
if(leftHeight == -1)
return -1;
... 阅读全帖
A***o
发帖数: 358
16
一样的code。本地c++编译,用leetcode的测试例子一个个测,都对。用leetcode自己
的judge,过了一半。
大家遇过这个情况吗? Word Ladder
W********e
发帖数: 45
17
remove duplicate in sorted array这道题,虽然现在leetcode已经没有这题了,只有
follow up 的judge。不过我还是写了一段代码,顺便用leetcode来judge一下。不知道
为什么我在A数组最后加了一个结束符,就出现run time error了?而我用c-free验证
却没问题?代码如下,麻烦大家了!
class Solution {
public:
int removeDuplicates(int A[], int n) {
int newArrIndex=0,index=0,newlen=0;
if(n==0)
return 0;
while(index {
if(A[index]==A[index+1])
{
A[newArrIndex]=A[index];
}
else
{
A[newArr... 阅读全帖
A***o
发帖数: 358
18
来自主题: JobHunting版 - 有可以代替leetcode的oj吗?
从昨天晚上leetcode down了以后,就没怎么做题了,自己用emacs写代码写测试,太慢
了,知道有能代替leetcode的online judge吗?
m****1
发帖数: 41
19
来自主题: JobHunting版 - leetcode一down,满版都是hackerrank
话说leetcode 啥时候能复原。。准备面试等着上面的题来练。。。还有哪有leetcode
的题库么
j*****y
发帖数: 1071
20
来自主题: JobHunting版 - leetcode 的编译器是旧的还是新的?
我的电脑的是 g++ 4.4.3 ,编译下面的代码可以过,但是 leetcode过不了
定义了一个 函数
bool comp(const pair & a, const pair & b);
然后有个 vector > v;
然后调用 sort(v.begin(), v.end(), comp);
我的电脑可以编译。 但是 leetcode给了这个错误
no matching function for call to 'sort(std::vector basic_string > >::iterator, std::vector string > >::iterator, )
l******n
发帖数: 1250
21
请问,二爷总结的leetcode,从易到难的顺序在哪里?
想做leetcode的题了,谢谢!
x*****0
发帖数: 452
22
来自主题: JobHunting版 - leetcode 3sum
遇到一个奇怪的问题。对于同样的数据集,在自己的IDE上测试,没有任何问题,
leetcode的onlinejudge却报错。
例如:
leetcode online judge
input output expected
[0,0] [[0,0,0]] []
[1,2,-2,-1] [[-2,2,0],[-1,1,0]] []
[-1,0,1,2,-1,-4] [[-1,1,0]] [[-1,-1,2],[-1,0,1]]
在自己的IDE上,能够给出expected的答案。
下面是我的代码:
class Solution {
public:
vector > threeSum(vector &num) {
// Start typing your C/C++ solution below
// DO NO... 阅读全帖
N*D
发帖数: 3641
23
来自主题: JobHunting版 - leetcode down了吗
Dear readers of LeetCode, you may have noticed the error message "500
Internal Server Error" quite often since yesterday. I am working hard to
resolve these issues, and hopefully LeetCode will be faster starting
tomorrow.
c**y
发帖数: 172
24
来自主题: JobHunting版 - 关于leetcode使用方法一问
刚刚solve了一个leetcode上的题,很是激动。
但是如何能够更新状态呢?我的进度条上总是
“You have solved 0 / 132 problems.”
请问如何在leetcode上如何记录已经解决的问题数目呢?
s*********e
发帖数: 197
25
来自主题: JobHunting版 - 菜鸟追leetcode之一[text justification]
为了积攒人品RP,为了H1B顺利,为了有更好的工作,为了有一个更好的将来,开始追
leetcode,并写下自己的做题感受和大家分享,更是作为自己的督促。做题目的原则如
下:
1) Optimized Algorithms to pass the "large" test.
2) Proper abstraction
3) Write the code whose correctness is *easy* to reason about.
4) Favor readability over efficiency without compromising item 1).
5) Rearrangement and tweaking
我试图对自己进行训练的目标就是写完代码,能够确认自己写对了。目前为止,我有一
些小小的心得,会贯穿在下面和以后的文章中。第一,循环不变式;第二,优化控制流
;第三,适度抽象,语义精确的子函数。
抛砖引玉,献上第一弹:Text Justification. 为了更好的可读性,想用一种类C的伪
代码并尽量省略一些类型声明。很多叙述可能比较罗嗦,见谅。
首先要考虑的... 阅读全帖
x*****0
发帖数: 452
26
来自主题: JobHunting版 - unique binary tree 2 (leetcode)
下面是这道题的链接:
http://leetcode.com/onlinejudge#question_95
下面是我的代码:
class Solution {
private:
vector helper(int start, int end) {
if (start > end) {
return vector(1, NULL);
}

vector result;

for (int i = start; i <= end; ++i) {
vector left = helper(start, i-1);
vector right = helper(i+1, end);

for (int m = 0; m < left.size(); ++m) ... 阅读全帖
j****y
发帖数: 684
27
我觉基础很重要吧,都要会的。
前段时间看那个拿到f offer的人,图考了,几何考了,这leetcode都没有呀。
话说你碰到一个考很多图算法的,而leetcode上基本没图,咋整。
o******e
发帖数: 1001
28
来自主题: JobHunting版 - leetcode中tree的表示方法
刚开始做leetcode,发现测试code的时候,leetcode tree的输入方法有点不懂。比如
{1,#,2},{1,2,3,4,#,#,5}分别对应什么样点的binary tree? 多谢!
s**********r
发帖数: 8153
29
来自主题: JobHunting版 - leetcode 挂了?
惊愕的发现,你也需要刷leetcode?
牛人阿。。。牛人也需要leetcode?
p*****3
发帖数: 488
30
来自主题: JobHunting版 - Leetcode一直没加新题?
大半年没用leetcode了,
刚扫了一下OJ居然没加新题。。
以后Leetcode是不是可以做成public的样子,设几个admin,大家可以提交题目和test
cases,经admin审核通过后就可以加上了。
u*****o
发帖数: 1224
31
来自主题: JobHunting版 - 刷完一遍leetcode之后要干嘛
1)做CC150
2)做EPI, PIE
3)直接去面试!
做完上面几本书后,估计这时你的LEETCODE也忘的差不多了,然后再开始LEETCODE第二
遍,
然后再开始CC150第二遍,如此循环往复,
s******n
发帖数: 20
32
来自主题: JobHunting版 - a leetcode problem: 重建BST
这是Leetcode上的一篇文章:
leetcode.com/2010/09/saving-binary-search-tree-to-file.html
里面的重建BST代码我觉得有问题:
void readBSTHelper(int min, int max, int &insertVal,
BinaryTree *&p, ifstream &fin) {
if (insertVal > min && insertVal < max) {
int val = insertVal;
p = new BinaryTree(val);
if (fin >> insertVal) {
readBSTHelper(min, val, insertVal, p->left, fin);
readBSTHelper(val, max, insertVal, p->right, fin);
}
}
}
void readBST(BinaryTree *&root, ifstream &fin) {... 阅读全帖
s******n
发帖数: 20
33
在leetcode看到Binary Tree Level Order Traversal II,看不出和Binary Tree
Level Order Traversal有什么根本区别,不知道考点在哪里?
我把Binary Tree Level Order Traversal的最终结果一颠倒不就得到Binary Tree
Level Order Traversal II.
Binary Tree Level Order Traversal的链接在这里:
http://discuss.leetcode.com/questions/49/binary-tree-level-orde
哪位大牛指点一下?先谢谢了。
s*******h
发帖数: 3219
34
http://discuss.leetcode.com/questions/234/insert-interval
leetcode 上全是线性iterate的做法啊
f********a
发帖数: 1109
35
自己运行结果都没问题。leetcode编译都出错
/usr/gcc_4_7/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/
bits/stl_vector.h:1137:4: error: invalid conversion from 'int' to 'std::
vector::value_type {aka TreeNode*}' [-fpermissive]
[发表自未名空间手机版 - m.mitbbs.com]
t****a
发帖数: 1212
36
来自主题: JobHunting版 - leetcode 129
楼主说的这题实际上是第127题
刚做了个clojure的解法,比java要短小很多。
可惜不能在leetcode上测试大数据,真心希望leetcode支持C/C++/Java以外的语言。
(defn word-map [dict]
(let [g (group-by first (for [word1 dict
word2 dict
:let [wd (word-dist word1 word2)]
:when (== wd 1)]
[word1 word2]))
ks (keys g)
vs (map (partial mapv second) (vals g))]
(zipmap ks vs)))
(defn word-dist [word1 word2]
(reduce + (map (f... 阅读全帖
z*******3
发帖数: 13709
37
来自主题: JobHunting版 - leetcode 129
这题完全是用来对付leetcode用的
平常不太会写成这样
leetcode上的难度比面试时候要难,尤其是难题
当作练习蛮好
online judge,按照日期降序排列
第一题是最下面那题
h**o
发帖数: 548
38
来自主题: JobHunting版 - leetcode: integer to roman 结果不同
intToRoman(4)在自己机上得 VI. 但在leetcode上得IIII,expect VI. 所以leetcode没
过。
你们有类似问题吗?一下是我的程序:
另:你们都懂罗马数字吗? 我不懂,所以是看提示才知道大概怎么做。
string intToRoman(int num) {
unordered_map m;
m["M"] = 1000;
m["CM"] = 900;
m["D"] = 500;
m["CD"] = 400;
m["C"] = 100;
m["XC"] = 90;
m["L"] = 50;
m["XL"] = 40;
m["X"] = 10;
m["IX"] = 9;
m["V"] = 5;
m["IV"] = 4;
m["I"] = 1;
vector阅读全帖
h**o
发帖数: 548
39
来自主题: JobHunting版 - leetcode上大数乘代码
Given two numbers represented as strings, return multiplication of the
numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
我是把
1. 小的那个数 M 的 个位和 大的那个数 N 乘后放在一个 vector s1 里,
2. M 的 十位和 N 乘后放在一个 vector s2 里,s1 和 s2 移位相加。
3. repeat: 把M 的 各个 位 和 N 乘, 结果移位相加。。。
这么一写下来子函数都好几个。这速度肯定被拒。
可我平时就是这样做乘法的啊?
leetcode的代码是挺短的, 可他们都用一种诡异的res[i+j+1]...方法做乘法。你们都
这样做吗? 还是我孤陋寡闻?
你们有除了leetcode方法外的简单版本吗?
m**********e
发帖数: 22
40
今天重做leetcode:String Reorder Distance Apart。发现1337c0d3r给出的答案(http://discuss.leetcode.com/questions/31/string-reorder-distance-apart)有较大改进的地方:"used" array and the while loop inside the for loop are not needed. I wrote one with C#:
// String Reorder Distance Apart
public string ReorderDistanceApart(string str, int distance)
{
int[] freq = new int[256];
int[] used = new int[256];
bool[] except = new bool[256];
int n = str.Length... 阅读全帖
m*****n
发帖数: 2152
41
自己写了一个brute force的solution,每次运行都是Time Limit Exceeded。自己在机
器上跑过leetcode上failed例子,小于1 second出结果。难道leetcode对时间要求这么
严格?难道非要suffix tree的解啊?
r**h
发帖数: 1288
42
来自主题: JobHunting版 - leetcode就是劣根性叛徒
你搞反了吧,明明是先有的白板编程面试,后有的leetcode。

leetcode
a********m
发帖数: 15480
43
来自主题: JobHunting版 - leetcode就是劣根性叛徒
leetcode这么强大?你是说木有新东方米国学校都免考英语?

leetcode
a********m
发帖数: 15480
44
来自主题: JobHunting版 - leetcode就是劣根性叛徒
leetcode这么强大?你是说木有新东方米国学校都免考英语?

leetcode
p*****2
发帖数: 21240
45
来自主题: JobHunting版 - 关于对leetcode的攻击贴
火鸡大哥息怒。我觉得吧,Leetcode注定会成为名人,而名人就会碰到各种稀奇古怪的
人。因此要看得开,因为大家的眼睛还是雪亮的。这种问题以后也可能会不断的出现,
尤其是Leetcode名气越来越大以后,所以要看开点呀。这从侧面证明了自己是很成功的
r*******n
发帖数: 3020
46
来自主题: JobHunting版 - 关于对leetcode的攻击贴
支持本贴,希望leetcode不要介意那个无厘头的帖子。
从leetcode里学了很多,依然在艰难的刷题中。。。
a********2
发帖数: 87
47
来自主题: JobHunting版 - 关于对leetcode的攻击贴
我一般不回帖,这次也表达一下自己强烈支持的意愿。我也气不过那个帖子居然能够上
十大,为了不让它更火,压根没有回复。不过我觉得广大同胞眼睛还是雪亮的,最鄙视
那种自己不争气还把责任推给旁人的人。姑且不说刷题对于个人帮助有多大,认为刷
leetcode的人多造成行业竞争激烈的想法太幼稚了,什么事物刚出来的时候总比它稳定
饱和的时候容易吧。非常感谢leetcode大神,对于我这种没背景只有勤奋的人就是最好
的榜样!
s********u
发帖数: 1109
48
感觉准备过程中走了很多弯路,一开始看很多经验说是大多数公司cc150就够用了,是
神书,结果我做了三遍,版上很多题目只要没见过还是不会做。然后我就开始做
leetcode,目前做到一半,不会的就看看discuss版面,有一定成效。
我觉得真正提高最大的是最近看面经。感觉自己思路见识广了很多,也开始大致明白为
什么有些人一看题就知道应该用backtracking,或者dp什么的。
其实原因并不是面经这个题有什么区别,而是如果做careercup书,不会做就看答案,
答案只会告诉你这道题目怎么解,这是我觉得cc150写的不好的地方。比如他每个章节
有一点基础知识,但不会把这些跟题目对应起来。结果你还是不会分类。
做leetcode就好一点点,因为discuss上面很多人会写自己的分析过程。就是“为什么
想到这样做”。
做面经是收获最大的,因为做一道题目的时间最长,没有现成答案,不会做只能去搜资
料。虽然找资料有很多冗余的过程,但是反而开拓了见识,了解了很多分析和分类的方
法。其实就是一种“模式识别”
比如一个boggle game题,搜到网上很多人总结这个题,比如暴力回溯算法,建立trie... 阅读全帖
q*****w
发帖数: 62
49
来自主题: JobHunting版 - 如何实现leetcode
最近在准备面试刷leetcode,想到一个问题。leetcode是怎么实现的?
基本的user case就是: client提交代码到server,server编译并运行代码在测试集,
返回结果(包括编译错误,测试结果错误等)。
这样的online ide很多,个人觉得最重要的应该是安全问题吧。不能让用户提交恶意代
码。一个online ide 叫ideone.com, 发现居然还有个这样的引擎,叫Sphere Engine.
到底如何实现呢?
d*******g
发帖数: 51
50
来自主题: JobHunting版 - 刷三遍leetcode之后会怎样?
刷leetcode并不能解决所有问题,比如系统结构题和设计题,其实leetcode刷完一遍就
感觉继续提升遇到瓶颈了
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)