Skip to content

[FEATURE REQUEST] Add 4-Sum Problem #5786

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

Closed
nishchalgv1 opened this issue Oct 13, 2024 · 9 comments
Closed

[FEATURE REQUEST] Add 4-Sum Problem #5786

nishchalgv1 opened this issue Oct 13, 2024 · 9 comments

Comments

@nishchalgv1
Copy link
Contributor

What would you like to Propose?

I would like to propose adding an implementation of the 4-Sum Problem under the https://github.com/TheAlgorithms/Java/tree/master/src/test/java/com/thealgorithms/misc section of the repository.

Issue details

Problem Statement:
Given an array of N integers, your task is to find unique quads that add up to give a target value. In short, you need to return an array of all the unique quadruplets [arr[a], arr[b], arr[c], arr[d]] such that their sum is equal to a given target.

Example 1:
Input Format:
arr[] = [1,0,-1,0,-2,2], target = 0
Result:
[[-2,-1,1,2],[-2,0,0,2],[-1,0,0,1]]
Explanation:
We have to find unique quadruplets from the array such that the sum of those elements is equal to the target sum given that is 0. The result obtained is such that the sum of the quadruplets yields 0.

Example 2:
Input Format:
arr[] = [4,3,3,4,4,2,1,2,1,1], target = 9
Result:
[[1,1,3,4],[1,2,2,4],[1,2,3,3]]
Explanation:
The sum of all the quadruplets is equal to the target i.e. 9.

Additional Information

No response

@vinith-369
Copy link

vinith-369 commented Oct 13, 2024

@nishchalgv1 I would like to work on this issue, could u assign me?

@Hriishikeshh
Copy link

we can solve this by fixing 2 values then using 2 pointers to get other 2 values whose total sum equals to given value and return it

i would like to solve this,please assign it under hacktoberfest tag

@ArifRahaman
Copy link

/assign

@Krushit-Babariya
Copy link

@nishchalgv1 I want to contribute in it can i??

@devDEV03
Copy link

/assign

1 similar comment
@KunjMaheshwari
Copy link

/assign

@prabhatsingh415
Copy link

Hi, I'd like to work on this issue. Could you please assign it to me?

Moulali2004 added a commit to Moulali2004/Java_2024 that referenced this issue Oct 21, 2024
Moulali2004 added a commit to Moulali2004/Java_2024 that referenced this issue Oct 21, 2024
@prabhatsingh415
Copy link

/assign

@siriak
Copy link
Member

siriak commented Oct 23, 2024

We do not add Leetcode problems

@siriak siriak closed this as completed Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants