slycelote / caide

Automates certain common tasks that you do during programming competitions
84 stars 18 forks source link

LeetCode support #50

Closed mingyEx closed 2 years ago

mingyEx commented 2 years ago

Very much looking forward to

slycelote commented 2 years ago

Possibly. Depends on how many people want it.

mingyEx commented 2 years ago

You reopened it to count how many people would expect leetcode support?

I don't know cf, but as far as I know, only novices like me will copy the code to the local IDE among Leetcode users, and Leetcode only needs to implement a class, so the IDE plug-in may not be very useful.

But I very much hope, if possible, to add support for simulation problems to Leetcode. Like this https://leetcode-cn.com/problems/stack-of-plates-lcci/

When the input data represents a function call and the corresponding parameters, the user can simply input the string itself, and then view the result at the i-th position, just like this. https://github.com/mingy532/Trivial_thing/blob/master/Reflection_in_boost.cpp#L157

Instead of manually writing a lot of things such as

Solution s;
s->func1(...)
s->func2(...)
...

If you plan to add support for leetcode, I hope you can add this feature.

slycelote commented 2 years ago

The issue is open to track progress of this feature request, including user comments/plus-ones (although I can't give any ETA). Thanks for detailed explanation of simulation problems. I can't read Chinese, but I assume it's similar to Dinner Plate Stacks.

mingyEx commented 2 years ago

I saw this question in the《crack the coding interview》. The Chinese site LeetCode puts all the questions in this book into one topic, so I don't know its official title number. They are indeed the same problem, thank you for taking the time to find it.

slycelote commented 2 years ago

@KargathEx I added basic support for LeetCode and published a beta release here. I'd appreciate if you could test this out.

Regarding "simulation problems" -- do you have more examples, or maybe there's a general way to search for them?

Note that quite a few LeetCode problems involve custom structures, like TreeNode. Those are not yet supported either.

mingyEx commented 2 years ago

Thanks, I will try it! By the way, about the construction of custom data structures, you can refer to this https://github.com/KargathEx/lc_debug/blob/main/lc.h

mingyEx commented 2 years ago

simulation problems:https://leetcode.com/tag/simulation/

mingyEx commented 2 years ago

Asking an unrelated question, how do you guys debug simulation problems while playing at codeforce, I find it too hard to keep track of its state in my head, and too tiring to manually write code that simulates function calls.

mingyEx commented 2 years ago

https://www.boost.org/doc/libs/develop/libs/describe/doc/html/describe.html#example_json_rpc This one might work too, but I don't know how to handle the case where the input parameter is empty.

mingyEx commented 2 years ago

It works fine.

but Error for this link: https://leetcode.com/problems/k-highest-ranked-items-within-a-price-range/ aaaaa

slycelote commented 2 years ago

simulation problems:https://leetcode.com/tag/simulation/

Thanks! I found a better tag: https://leetcode.com/tag/design/

how do you guys debug simulation problems while playing at codeforce, I find it too hard to keep track of its state in my head, and too tiring to manually write code that simulates function calls.

I don't really have experience with those, do you have example URLs?

It works fine.

but Error for this link: https://leetcode.com/problems/k-highest-ranked-items-within-a-price-range/

Thanks! The problem is with multi-dimensional vectors. This will be fixed in release version.

mingyEx commented 2 years ago

Thanks, I will try it! By the way, about the construction of custom data structures, you can refer to this https://github.com/KargathEx/lc_debug/blob/main/lc.h

Sorry I just noticed that link is inaccessible , update: https://github.com/luckystone60/leetcode-helper

slycelote commented 2 years ago

@KargathEx I published another beta release that should support majority of LeetCode problems: https://github.com/slycelote/caide/releases/tag/v2.10.0-beta2

slycelote commented 2 years ago

Published 2.10 release