Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On the topic of websites like LeetCode #245

Closed
jmerle opened this issue May 21, 2022 · 4 comments
Closed

On the topic of websites like LeetCode #245

jmerle opened this issue May 21, 2022 · 4 comments

Comments

@jmerle
Copy link
Owner

jmerle commented May 21, 2022

Because of the existence of many issues asking for support for certain online judges, I decided to create a more elaborate issue explaining the reasons behind rejecting these feature requests every time. This issue concerns all online judges that require you to write your code in predefined functions or classes, like LeetCode, GeeksforGeeks, Topcoder, InterviewBit, CodeStudio, and binarysearch.

Competitive Companion's most important feature is its ability to provide access to the problem data of 60+ online judges in a generic way. It's able to do this because the online judges it currently supports all follow roughly the same format, where you are free in how you structure your code, where all input/output is string-based, and where input/output is communicated via stdin/stdout or via files.

This consistency makes it possible for Competitive Companion to aid external tools in 2 important tasks for all of these judges: generating relevant skeleton files and running sample cases locally. Currently all parsers in Competitive Companion are able to aid in both of those tasks, and I expect all future parsers to be able to do so as well.

The primary reason why feature requests for the aforementioned websites are rejected every time is because their "complete this function or class, don't use your own template" format is completely different from these 60+ other judges. You are not free in how you structure your code, and these websites usually provide template code that is not able to compile in your local environment, let alone run the sample cases locally (missing main function, missing imports, missing class definitions, etc.). In other words, the problem format these websites use does not fit within Competitive Companion's set of supported problem formats.

Theoretically it is possible for a browser extension to fix the previously mentioned problems automatically. Such an extension would have to parse problem pages like Competitive Companion does, but also needs to convert the template code so that it can compile and run sample cases in a local environment. It'd have to be generic so that it works with all problems (it's not always just a single function call with a trivially constructed argument), for multiple programming languages (LeetCode alone already supports many popular languages), and for multiple websites.

However, I consider such functionality to be way outside the scope of Competitive Companion, and totally worthy of being a standalone project (not created by me though).

Another issue that affects several of these websites is that their sample case format is inconsistent. This makes it very hard for any extension to consistently parse the provided input/output samples correctly.

Please know that creating new issues requesting support for these websites won't help. The answer hasn't changed since 2018 and isn't likely to change any time soon.

@KorigamiK
Copy link

I do understand what you mean when you say that competitive companion wouldn't be as consistent when we add parsers for websites which require code to be in a predetermined format and the rest cases are not stdin/stdout.

However, when I use the extension I usually just want to code the problem using my local ide to get faster compilations and use the debugger. Just a click on the extension opens my editor and I can start the problem there. If it is sometimes not able to get the boiler plate code or the test cases, it still helped me to get on my ide and create a file without any effort.

A perfect solution for such websites may not exist but we can still provide this partial support instead of avoiding then. Some extra info can be shown when the user tries to parse a problem from unsupported website.

@jmerle
Copy link
Owner Author

jmerle commented Jun 15, 2022

However, when I use the extension I usually just want to code the problem using my local ide to get faster compilations and use the debugger. Just a click on the extension opens my editor and I can start the problem there. If it is sometimes not able to get the boiler plate code or the test cases, it still helped me to get on my ide and create a file without any effort.

I understand your use case of having quick access to a local file in an environment that's all set to get going, but it's not what this extension is built for, and easily something that external tools can provide on their own.

A perfect solution for such websites may not exist but we can still provide this partial support instead of avoiding then. Some extra info can be shown when the user tries to parse a problem from unsupported website.

I disagree. I'm not willing to drop the aforementioned consistency for the sake of adding partial parsers that are (in my opinion) out-of-scope for this extension.

@Sakib62
Copy link

Sakib62 commented Dec 7, 2022

Wish someone will make an extension to parse from those sites.

@goyalyashpal
Copy link

hi! thanks a lot for creating this extension and also for sharing this writeup.

i completely understand your concern, and totally agree with points raised. i also was feelng the same regarding quoted part.
so, would u mind sharing a recommendation for any such site which's supported by competitive-companion?

i tried codeforces, but that doesn't really fit (or say i don't know how to tune it to) the problems that leetcode offer. it gives abstract names to problems - which works if doing things recreationally, but not when using it as a guided syllabus.

i also tried hackerrank too, but similar problem as above.

The primary reason why feature requests for the aforementioned websites are rejected every time is because

  • their "complete this function or class, don't use your own template" format ...
  • You are not free in how you structure your code, and
  • these websites usually provide template code that is not able to compile in your local environment, let alone run the sample cases locally (missing main function, missing imports, missing class definitions, etc.).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants