SarthakKeshari / CPP-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
47 stars 132 forks source link

Added Gray code solution #388

Closed diwakarsingh18277 closed 2 years ago

diwakarsingh18277 commented 2 years ago

Issue Id you have worked upon -

Kindly write your answer here

Briefly explain your program logic -

Kindly write your answer here

Screenshots(Attach 2 screenshots of your own input and output) -

Attach here


Checklist:

Eg - If your code follow the below guidelines. Kindly change [] to [x]

All the conditions should be fulfilled for considering your code for merging -

SarthakKeshari commented 2 years ago

@diwakarsingh18277, Kindly create an issue first and then PR. And follow the PR template and contribution guidelines. I am not closing this PR since this was your first time. You may refer CONTRIBUTING.md and create an issue.

Kindly create an issue now and claim it.

diwakarsingh18277 commented 2 years ago

Thanks, I have created an issue and waiting to be assigned.

SarthakKeshari commented 2 years ago

Thanks, I have created an issue and waiting to be assigned.

I have recently assigned. Now you may fill the above PR with your answers to the questions asked.

diwakarsingh18277 commented 2 years ago

I have already added the solution with this PR. Please Merge this PR.

SarthakKeshari commented 2 years ago

@diwakarsingh18277, Kindly fill the PR template

diwakarsingh18277 commented 2 years ago

Issue Id you have worked upon -

391

Briefly explain your program logic - recursively changing only one bit of number and storing the number in a vector. for better understanding you can refer to my post : https://leetcode.com/problems/gray-code/discuss/1507279/c-recursive-explained-with-diagram-easy-to-understand

Screenshots(Attach 2 screenshots of your own input and output) -

image

Checklist: Eg - If your code follow the below guidelines. Kindly change [] to [x]

All the conditions should be fulfilled for considering your code for merging -

[x] I have mentioned the question as comment in my solution file.

[x] My code follows the guidelines of this project.

[x] I have performed a self-review of my own code.

[x] I have commented my code.

[x] My code gives the correct output.

[x] I confirm that I have not copied the code from anywhere. In case its found that I have copied even after successful merge then I can be banned from the repository and hacktoberfest.

[x] I affirm that I strictly follow contributing guidelines and code of conduct.

diwakarsingh18277 commented 2 years ago

Done. Commented all the code.