skygragon / leetcode-cli Goto Github PK
View Code? Open in Web Editor NEWA cli tool to enjoy leetcode!
License: MIT License
A cli tool to enjoy leetcode!
License: MIT License
Updated to 0.10.0 and logged in, but "leetcode show" command can no longer display the description of the problem. When I try to submit the solution generated by "leetcode show [Number] -g -x -l java", it always returns "[ERROR] http error [500]", but "leetcode test" command works just fine.
It shows "ERROR: failed to load locked problem!" even I am a premium user.
Due to there's some syntax different between python2 and python3, I think we should have lang python3
.
when I test or submit the program, it returns error:ERROR: HTTP failed:403.
How could I figure it out?
Question description is not shown up.
leetcode show 372
leetcode test ./.cpp -t testcase
, it occurs error adding quotation marks on testcase, the command documentations
may need changed :).-i
in test occasion, when I use leetcode test ./.cpp -i
in Win10, I don't know what to do next and I tried some input, cmd didn't response.beats 100% of cpp submissions
? Actually it didn't.List [Keyword] only works for lowercase letter
e.g
Run "lc list Rotated", and there is no results.
Run "lc list rotated", it works correctly and shows:
[154] Find Minimum in Rotated Sorted Array II Hard (35.69 %)
[153] Find Minimum in Rotated Sorted Array Medium (37.96 %)
[ 81] Search in Rotated Sorted Array II Medium (32.66 %)
[ 33] Search in Rotated Sorted Array Hard (31.40 %)
or provide a way to clean cache on demand when necessary?
yefeiw@yefeiw-linux:/local/mnt/workspace/practice/java/bloomberg$ leetcode submit 62.unique-paths.cpp
✔ Accepted
✔ 61/61 cases passed (3 ms)
yefeiw@yefeiw-linux:/local/mnt/workspace/practice/java/bloomberg$ leetcode submit 98.validate-binary-search-tree.cpp
ERROR: http error
yefeiw@yefeiw-linux:/local/mnt/workspace/practice/java/bloomberg$ leetcode version
0.9.0
yefeiw@yefeiw-linux:/local/mnt/workspace/practice/java/bloomberg$ leetcode submit 98.validate-binary-search-tree.cpp
ERROR: http error
The second '\n' was not treated as a escape character
Repro:
Leetcode$ lc test reverse-linked-list-ii.java -t '[5]\n1\n1'
Input data:
[5]
1\n1
Your
✘ Runtime Error
✘ runtime: N/A
✘ output:
Expected
✘ Runtime Error
✘ runtime: N/A
✘ output:
It would be nice if the cli tool can provide the input format or examples of test cases.
The SQL problems seem couldn't be accessed, by using the following command:
leetcode show 175
Here is the link for 175 problem: https://leetcode.com/problems/combine-two-tables/#/description
Is there any plan to support this?
Thanks for creating this great tool.
It would be nice to add the feature to be able to fetch the top discussion post into cli.
Will you add command to show language template?
Such as
class Solution {
public:
int lengthOfLongestSubstring(string s) {
}
};
in c++
Hello, I don't know how to do that? Can you provide a guide?
When I use submit problems with golang, Leetcode give me the error '✘ Line 1: syntax error: non-declaration statement outside function body'
应该是**人吧英文不好, 我就说中文吧, 因为没有过滤函数体之外的一些代码, 所以会导致提交问题的编译错误, 比如:
package problems
import "strconv"
func fizzBuzz(n int) []string {
res := []string{}
for i := 1; i <= n; i++ {
a := ""
if i%5 != 0 && i%3 != 0 {
a = strconv.FormatInt(int64(i), 10)
} else {
if i%3 == 0 {
a = "Fizz"
}
if i%5 == 0 {
a = a + "Buzz"
}
}
res = append(res, a)
}
return res
}
Want to see only the questions that I haven't solved. Has the function been implemented yet?
those headers like 'Cookie' or 'Set-Cookie' are critical to user authorization, better to filter them out in trace log thus user can paste the log directly w/o any security risk.
It could be a network issue, the command works a few hour after, cheers.
Having trouble loading problem with 'leetcode show'. Also, is there a debug switch for more logging? I'd like to provide more information but I don't know how.
System Environment:
[email protected]
[email protected]
Currently run leetcode show xx -g -x
it will generate a file named "xx.xxx-xx-xx.java". However, Intellij IDEA will throw an error:
Error:(1, 8) java: class Solution is public, should be declared in a file named Solution.java
.
Is there an option so that user can generate a file named "Solution.java"?
Thanks!
Even I paid, it still shows ERROR: failed to load locked problem!
I noticed one guy had the same issue here. It might be network issue, I could access web link well. And I tried changing network still the same.
System Environment:
[email protected]
[email protected]
And if I run it with verbose log, it prints below:
loading from all.json
ERROR: failed to load problem!
Any idea how could I resolve this?
Installed it on bash on osX.
After logging in with lc user -l
, the command succeeds with a Successfully logged as <username>
message.
But the session expires almost immediately. Any other command fails with a ERROR: session expired, please login again
message.
Logging in again does not change the behavior.
Best leetcode bash tool I ever found! Love it.
It would be nice not only show how many test passed/failed, but also detail output especially for errors.
Hi, I found this tool on 1point3acres and I'm interested in improving it.
Since leetcode change their URL for problem list, your PROBLEM_URL is not working now. I figured out the new API URL and made some change.
Besides, I have two questions about your implementation:
It conflicts with C# Mono compiler and can cause a hell lot of troubles. Please change to use the full name "leetcode". Thanks.
Can we add an option to list questions by company tag?
For example:
leetcode list -c google
List all google questions.
Can you solve this problem? �
Actual Results:
The problem description is incomplete and shows as below:
[372] Super Pow
https://leetcode.com/problems/super-pow
Expected Results
The problem description should be complete and same as https://leetcode.com/problems/super-pow/#/description
[208] Implement Trie (Prefix Tree)
https://leetcode.com/problems/implement-trie-prefix-tree
It will exception by using this example.
When a submission got runtime error, there is no detail message return to the console. It would nice if leetcode-cli can pull the detail error msg.
When i use following cmd:
leetcode star 233
I got an error message:
ERROR: http error
I could confirm i already login
RT.
Hello,
I have successfully installed leetcode-cli. Then when I run "leetcode list" or "leetcode help", the command failed with "/usr/bin/env: node: No such file or directory".
Do you know what's wrong here?
Thanks.
Jintao
recently leetcode.com has updated to only show acceptance percentage in the page, no detailed accept/submit counts provided.
e,g Simplify Path
怎么能显示其他类型的题目呢,比如database 之类的
Add the optional parameter keyword
for the submit
and test
commands, for command:
submit <filename> [keyword] submit final solution to leetcode
test <filename> [keyword] send solution to leetcode and run test
I turned on "ALWAYS_LOGIN" for both my computers. When I submit from one of the computer and run "leetcode list" in another one, it still keeps the old list (without the submitted one). I wonder if it's possible to refresh the list instead of using cache? Or do I have to run lc user -l
each time?
Thanks!!
/usr/local/lib/node_modules/leetcode-cli/lib/commands/submit.js:60
if (!submission.distributionChart) return;
^
TypeError: Cannot read property 'distributionChart' of undefined
at /usr/local/lib/node_modules/leetcode-cli/lib/commands/submit.js:60:26
at /usr/local/lib/node_modules/leetcode-cli/lib/leetcode_client.js:201:19
It happens occasionally. I think the reason is that the leetcode_client.js getSubmission()
call is not successful, and the callback function doesn't handle the error correctly: https://github.com/skygragon/leetcode-cli/blob/master/lib/commands/submit.js#L60
Perhaps adding a if (e) {}
check to throw it.
with latest build, still did not see runtime error in cli, so currently I have to login to web for debugging.
Test case:
leetcode test zigzag-conversion.java -t '[3,9,20,null,null,15,7]'
Actual Output:
Your
✘ Runtime Error
✘ runtime: N/A
✘ output:
Expected
✘ Runtime Error
✘ runtime: N/A
✘ output:
Excepted output
Line 21: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
public class Solution {
public List zigzagLevelOrder(TreeNode root) {
List res = new ArrayList();
dfs(root, 0, res);
return res;
}
public void dfs (TreeNode node, Integer level, List res ){
if (node == null){
return;
}
List levelNodes = res.get(level);
if (res.get(level) == null){
levelNodes = new ArrayList();
res.add(levelNodes);
}
//right; left
if (level % 2 == 1){
levelNodes.add(0, node.val);
}
else {
levelNodes.add(node.val);
}
dfs(node.left, level+1, res);
dfs(node.right, level+1, res);
}
}
If test/submit too fast, the program will hang. Add some delay would help.
e.g. use the git number, then we can easily know what's the exact version of leetcode-cli we are using.
This problem has also been noted at leetcode_client.js:151
If I run "./bin/lc submission -a" with an expired session, I'll get a list of problem names followed by: ERROR: no submissions?
If I run "./bin/lc show" on a locked problem with an expired session, I'll get ERROR: failed to load locked problem!
If a user login the leetcode website, and then use the cli to access locked problem, it will show "ERROR: failed to load locked problem!"
It seems that leetcode had updated it's anti-crawler strategy, so that I can login but can't get the problem list.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.