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

3 sum closest #539

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rahulgoyal8312
Copy link

@rahulgoyal8312 rahulgoyal8312 commented Oct 30, 2021

Choose your form and fill it -

1. Form 1(C++ Solution contributors)


1) Form 1

Issue Id you have worked upon -

Given a target element, need to find the sum of exactly three numbers from an array which should be around or equal to that target element.

Briefly explain your program logic -

Sort the array provided, then using two pointer approach need to calculate the sum of (currentIndex) + (currentIndex+1) + (RightIndex) and find the absolute difference and keep track of a variable "closest" which will be updated if the resultant value is lower than existing closest value.

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

Screenshot 2021-10-31 at 2 14 11 AM

Screenshot 2021-10-31 at 2 14 37 AM


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 -

  • I have mentioned the question as comment in my solution file.

  • My code follows the guidelines of this project.

  • I have performed a self-review of my own code.

  • I have commented my code.

  • My code gives the correct output.

  • 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.

  • I affirm that I strictly follow contributing guidelines and code of conduct.

@SarthakKeshari
Copy link
Owner

@rahulgoyal8312,
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(present in the repository) and create an issue(iff program has not been done in repositories probable folders).

If above given lines follow, then kindly create an issue now and claim it. I will assign it to you.

@rahulgoyal8312
Copy link
Author

@SarthakKeshari Do take a look at this PR for the 3 Sum Closest issue that you've assigned.

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.

None yet

2 participants