leetcode-patterns icon indicating copy to clipboard operation
leetcode-patterns copied to clipboard

Random Problem Generation

Open doranmartinez opened this issue 3 years ago β€’ 5 comments

Would be cool to have a button that randomly selected a problem to study.

doranmartinez avatar May 09 '22 18:05 doranmartinez

Hello there, Can I please try to work on this issue? I would like to contribute!

Shashank5665 avatar Jul 24 '22 03:07 Shashank5665

Hi @Shashank5665! Yes, please go ahead and let me know if you have any questions!

seanprashad avatar Jul 24 '22 10:07 seanprashad

Hey @Shashank5665! 😁 I'm checking in to see how you're doing and if I can provide any help/suggestions?

seanprashad avatar Aug 08 '22 00:08 seanprashad

Hello @seanprashad πŸ˜ƒ, I was able to successfully set up the project in my system. But, I was not familiar with react tables, useMemo, and a few other things in this project, and currently, my college exams are going on too😐. So, I was a bit busy with that.. but yeah I am in the process of learning react and I will definitely complete this once my exams are over, which will get over within 2 weeks or so.

Shashank5665 avatar Aug 08 '22 02:08 Shashank5665

Hello @seanprashad πŸ˜ƒ, I was able to successfully set up the project in my system. But, I was not familiar with react tables, useMemo, and a few other things in this project, and currently, my college exams are going on too😐. So, I was a bit busy with that.. but yeah I am in the process of learning react and I will definitely complete this once my exams are over, which will get over within 2 weeks or so.

Okay sounds good! Don't hesitate to let me know if you need help, or if you'd like to open this up for another contributor. Good luck in your exams!

seanprashad avatar Aug 08 '22 02:08 seanprashad

Hello @seanprashad, My exams are over :D and I am continuing with the feature, I created a button that when clicked generates a random question, but I have made it such that it opens a new tab and takes the user to the leetcode site with the generated random question. I am finding it a bit difficult in understanding the Header and Cell cuz of which I am not getting how to render the generated question as a row.

Shashank5665 avatar Aug 19 '22 15:08 Shashank5665

Hello @seanprashad, My exams are over :D and I am continuing with the feature, I created a button that when clicked generates a random question, but I have made it such that it opens a new tab and takes the user to the leetcode site with the generated random question. I am finding it a bit difficult in understanding the Header and Cell cuz of which I am not getting how to render the generated question as a row.

Sounds like you're making solid progress so far! Do you have a branch that we could take a look at? Feel free to open a "Draft" Pull Request - that would make it much easier for me to concretely point you in the right direction!

As far as Header and Cell, Header is the code that will generate the "first row" of the table where we have things like dropdown menus:

Screenshot 2022-08-19 at 1 17 01 PM

I think we could place the "Random question" button inside the Header section for Questions, aka right here: https://github.com/seanprashad/leetcode-patterns/blob/8d25c761f53e5e2bfcfa25f36d18e5e8a15fe0b4/src/components/Table/index.js#L235

Note that we'll need to add some JavaScript code to specify that "We want to customize this header with a random question button". We've actually already done this for the Hide/Show Patterns toggle - use it as a baseline for your work: https://github.com/seanprashad/leetcode-patterns/blob/8d25c761f53e5e2bfcfa25f36d18e5e8a15fe0b4/src/components/Table/index.js#L289-L309

Cell is used to refer to the contents of each row - I don't think we'll need to edit the cell in this case, since we don't want the "Randomize Question" button to show up for each and every row! Start small and try to get a button that doesn't do anything with the text "Hello World" to appear. After that, we can discuss how to random the href link that will open when clicked!

Please let me know if anything is unclear - you've got this! 😁

seanprashad avatar Aug 19 '22 17:08 seanprashad

Fixed with #240

seanprashad avatar Aug 22 '22 16:08 seanprashad

Thank you so much @doranmartinez for opening this issue, I was able to implement this feature with the help of @seanprashad πŸ™Œ

Shashank5665 avatar Aug 22 '22 17:08 Shashank5665