[Discuss] TWO SUM

Hey folks,
Let’s discuss anything related to the TWO SUM problem in this thread

base case 2 is failing
any hint?

1 Like

edge-test 1 failed.
any hints?

HInt for edge test 1: Does your code handle the same number occurring twice in the input, which could add up to the required sum?

1 Like

Yeah got it. Thank you.

T

here’s a problem with my workspace. Correct content is not loading for two sum problem. I have tried to reload and deleted the browsing data. But the problem persists. Previously solved modules have no such problem. I am attaching a screenshot.

It has weak test cases o(n^2) solution passed

the question mentions that we can use two different elements with the same value

That is correct. You cannot use the same element twice, but if 2 different elements have the same value, you can use them.

What should be the output for this case:
5
2 2 4 5 6
6
or this is a invalid case?

That is invalid since it has 2 solutions.
However, this is valid
5
2 2 4 5 6
4

i guess this one doesn’t have perf-test(s), but thats okay.

Did you find out what was going wrong i am getting the same base test 2 case failure?

base case 2 is failing any hint?

@YogeshUpadhyay Notice that for the given input you might have return wrong indices because you have to return the index that is followed input.
Example:

5
1 5 4 2 2
4
ans: 3 4

2 Likes

@Kiran sir While implementing the solution in python. I am getting a ModuleNotFound error.

it is showing no module named crio