Practice
Resources
Interview Guides
All Problems
Fast Track Courses
Community
Blog
Interview Preparation Kit
Video Courses
Contests
Online IDE
New
Online C++ Compiler
Online C Compiler
Online Python Compiler
Online Java Compiler
Online JavaScript Compiler
Free Mock
Powered By
Free Mock Assessment
Take popular mock tests for free with real life interview questions from top tech companies
Explore Mock Tests
Powered By
Mock Interview
Pair up with a peer like you and practise with hand-picked questions
Explore Mock Interviews
Events
New
Scaler
Please enter 3 or more characters
Experience Scaler
Experience Scaler
Profile
Settings
Help Requests
Profile
Settings
Help Requests
Login to experience InterviewBit
Sign in
Experience Scaler
Experience Scaler
Profile
Settings
Help Requests
Profile
Settings
Help Requests
Login to experience InterviewBit
Sign in
Practice
Improve your coding skills with our resources
Resources
Experience learning
Interview Guides
All Problems
Fast Track Courses
Community
Blog
Interview Preparation Kit
Video Courses
Contests
Compete in popular contests with top coders
Online IDE
Checkout our improved IDE
Online C++ Compiler
Online C Compiler
Online Python Compiler
Online Java Compiler
Online JavaScript Compiler
Free Mock
Assess yourself and prepare for interviews
Free Mock Assessment
Mock Interview
Events
Attend free live masterclass hosted by top tech professionals
New
Scaler
Explore Offerings by SCALER
Join Interviewbit
Get free unlimited access to our resources to help you prepare for your next tech interview
Sign Up or Login to get Started
Continue with Google
OR continue using other options
Are you sure you want to Exit?
You will not able to continue using resources without logging in.
Yes, Exit
No
Problem Discussion
Post a comment
This thread is for people who have not yet solved the problem. Please do not post solutions here.
R
ramya-sada
4 months ago
2sum problem in java through hashmap
0
Reply
S
smittal4be21_2cdf131
9 months ago
Striver's C++ Solution
0
Reply
C
chittudi-anil
10 months ago
Very simple sol among present ones
2
Reply
A
aman-ahmed-siddiqui
about 1 year ago
Incorrect problem statement!
1
Reply
K
khushi-garg_162
over 1 year ago
Best C++ solution. The time complexity is O(N) , and the space complexity is O(N)
0
Reply
N
nithin1897_bd2dabdc1
almost 2 years ago
Python solution new
0
Reply
P
pab-jee-gamer
almost 2 years ago
100% Fastest Solution With Explanation
0
Reply
A
anshumantyagi0_6a2c0
almost 2 years ago
Very Simple O(N) C++
0
Reply
N
naman-singh_767_723
almost 2 years ago
Simple understanding c++ solution o(nlogn) solution
0
Reply
K
kamal-bhera_748
about 2 years ago
Two Sum Javascript Simple Example
0
Reply
A
adeesh-1234
about 2 years ago
O(n *log(n)) , C++ solution
0
Reply
A
aditya-dixit_505
over 2 years ago
Java solution using hashmap and arraylist
0
Reply
D
dhruv-mangal_705
almost 3 years ago
JAVA easy Solution adding 1 condition for passing testcases
0
Reply
A
aryan-khanuja
almost 3 years ago
Any way to shorten this ? (A bit rusty nowadays (┬┬﹏┬┬) )
0
Reply
R
rahul-kumar_889
almost 3 years ago
Simple 100% fastest solution || C++
0
Reply
P
pink-flyod
almost 3 years ago
✔️ 100% Fastest Solution Explained
2
Reply
N
nikhil-b_twozerotwoo
almost 3 years ago
Question score overrated
0
Reply
2
2019uec1805_00a1013b
almost 4 years ago
Best explanation for this video on youtube
0
Reply
P
p-k_621
about 4 years ago
Return an empty list
0
Reply
K
kode-runner
over 4 years ago
Python Video Solution
0
Reply
K
kode-runner
over 4 years ago
C++ Video solution
0
Reply
S
saipranith
over 4 years ago
Simplest C++ solution by me
0
Reply
S
sumitsingh17_dfac1c0
over 4 years ago
Test case problem in A : [ 4, 7, -4, 2, 2, 2, 3, -5, -3, 9, -4, 9, -7, 7, -1, 9, 9, 4, 1, -4, -2, 3, -3, -5, 4, -7, 7, 9, -4, 4, -8 ] B : -3
5
Reply
S
sanyasharma2511_f4e4
over 4 years ago
Expected value seems not correct
1
Reply
S
sanyasharma2511_f4e4
over 4 years ago
Invalid expected o/p
1
Reply
A
anand2412
almost 5 years ago
Just for the sake of it,,..throw in a 3 sum as well!
0
Reply
G
gladiator2608
about 5 years ago
Please changes the array as return type in jdk 1.7
1
Reply
S
singhalharsh10081999
about 5 years ago
My Solution with great approach and easy implementation
0
Reply
N
nishtha-agrawal_401
about 5 years ago
Not getting appropriate result for the test case A={1,1,1}, B=2;
0
Reply
Post a comment
This thread is for people who have solved the problem. You may discuss your solutions here.
N
naveenkumar1july_f49
over 1 year ago
All AC using HashMaps , Pair Comparator, PriorityQueue
0
Reply
A
anupamverma
over 1 year ago
Easy Approach Using HashMap : O(n)
0
Reply
P
pratik_397
almost 2 years ago
C++ Easy Understandable Solution
0
Reply
V
vmanhas
about 2 years ago
Very very very simple c++ solution
0
Reply
_
_322_447
almost 3 years ago
Python O(n) runTime | O(n) space
0
Reply
C
chetan-verma_881
over 3 years ago
C++ Detailed solution
0
Reply
H
hari-kishan_449
almost 4 years ago
Any suggestions to optimize this code?
1
Reply
2
2019uec1805_00a1013b
almost 4 years ago
Best explanation for this video
0
Reply
T
ttanvibe19_cda4f7183
almost 4 years ago
When i use unordered_map in my dev c++ compiler its showing this: #error This fil
6
Reply
M
muditgupta373_3eb102
about 4 years ago
What is wrong with this code please tell
1
Reply
M
md_wahiduzzaman_khan
about 4 years ago
Easy Python solution using dictionary no sorting needed
0
Reply
D
devasudeeshna5_c83fd
about 4 years ago
Simple CPP solution Very Easy to understand
0
Reply
E
eric-chu
over 4 years ago
C++, super simple algorithm
2
Reply
R
rahul-priyadarshi
over 4 years ago
Easy java solution o(n) o(n)
0
Reply
S
shabanaali1240_f68c9
over 4 years ago
Nice solution, Java
0
Reply
H
himsindhu-biswas
over 4 years ago
Easy C++ solution using simple logic
0
Reply
U
underdog_10
over 4 years ago
Very Easy short 4 liner
1
Reply
L
lalitrana_11ccc942f9
over 4 years ago
Solution in O(n) space and O(n) time using unordered map in one loop
4
Reply
P
prashant-anand
almost 5 years ago
Check out my soln
0
Reply
A
arbit-interview
almost 5 years ago
I don't understand how my solution is different than the editorial or the fastest python code
0
Reply
A
aayush-mahajan_995
almost 5 years ago
Simple easy to understand cpp code
0
Reply
X
XRS
almost 5 years ago
Simple Java Solution 2 Sum
2
Reply
C
coderepeat2627
almost 5 years ago
Simple iterative C++ solution using Map
0
Reply
A
Ank_101
almost 5 years ago
Simple solution with unordered_map
0
Reply
S
shantam0810
almost 5 years ago
Easy To Understand intuitive C++ Solution
0
Reply
V
vikrantprasad5
almost 5 years ago
Python Solution more efficient then Editorial
2
Reply
0
0-BlurMachine-1
almost 5 years ago
O(n) solution using unordered_map
3
Reply
D
desh_ka_gunda
almost 5 years ago
How much time do u took to solve it
0
Reply
M
msbobby87
about 5 years ago
Easy O(n) Sol Cpp using Unordered Set
0
Reply
Click here to start solving coding interview questions
Join Interviewbit
Get free unlimited access to our resources to help you prepare for your next tech interview
Sign Up or Login to get Started
Continue with Google
OR continue using other options
Join Interviewbit
Get free unlimited access to our resources to help you prepare for your next tech interview
Sign Up or Login to get Started
Continue with Google
OR continue using other options
Unlock the complete InterviewBit
experience for free
Sign Up Using
Or use email
1 Million +
Strong Tech Community
500 +
Questions to Practice
100 +
Expert Interview Guides
Free Mock Assessment
Powered By
Fill up the details for personalised experience.
Phone Number
*
OTP will be sent to this number for verification
+1
*
Type to search
+1
No results found
Phone Number
Change Number
Graduation Year
*
Graduation Year
*
Type to search
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
No results found
*
Enter the expected year of graduation if you're student
Current Employer
Company Name
Type to search
No results found
College you graduated from
College/University Name
Type to search
No results found
Job Title
Job Title
Type to search
Engineering Leadership
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Co-founder
SDET
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer
Security Leadership
Database Administrator
Data Analyst
Data Engineer
Non Coder
Other
No results found
Please verify your phone number
Edit
Resend OTP
By clicking on Start Test, I agree to be contacted by Scaler in the future.
Already have an account?
Log in
Free Mock Assessment
Powered By
Instructions from Interviewbit
Start Test