Skip to content

add feature - generate random problem #9

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

Merged
merged 3 commits into from
Jul 28, 2019
Merged

Conversation

yue2388253
Copy link
Contributor

use "cargo run random" to generate a random problem.

use "cargo run random" to generate a random problem.
Copy link
Owner

@aylei aylei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM.
And this idea is interesting 😜

src/main.rs Outdated
match id_arg.as_ref() {
"random" => {
println!("You select random mode.");
id = get_random_id();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the problem is locked or don't have a rust version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, current implementation has such limitation.
Do you think we should verify whether the problem of generated id meet these two requirement at first? And regenerate an id that meets these two requirement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, using random mode to generate problems results in the disorder of lib.rs

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I think it is nice to have the ID re-generation, but a proper error message is also okay.
  2. It's not a problem, we don't have an order guarantee for lib.rs

Now that using "cargo run" is ok! Then the user could follow the guide of
the system output to do what he/she wants to do (e.g., generate a random
problem or select a particular problem).
@yue2388253
Copy link
Contributor Author

Now that the program can handle the case that the problem has no rust version.

However, I don't know what "the problem is locked" means? Could you please say it in more details?

@aylei
Copy link
Owner

aylei commented Jul 6, 2019

Now that the program can handle the case that the problem has no rust version.

However, I don't know what "the problem is locked" means? Could you please say it in more details?

I mean some problems are only available for leetcode premium, the subscription plan

Copy link
Owner

@aylei aylei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, is this PR ready to merge? @yue2388253

@yue2388253
Copy link
Contributor Author

Sorry to late reply. This PR is ready for merge.

BTW, recently I am preparing my paper and thus might not be able to work on this repo.

@aylei
Copy link
Owner

aylei commented Jul 28, 2019

@yue2388253 Thanks!

@aylei aylei merged commit f8f1aa7 into aylei:master Jul 28, 2019
Vahor pushed a commit to Vahor/leetcode-rust that referenced this pull request Jun 30, 2023
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

Successfully merging this pull request may close these issues.

2 participants