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.
O
omkar-kumar_917
3 months ago
Easiest solution c++ , n*32 ,without extra space
1
Reply
J
jeevan-malatesha
9 months ago
Easy O(n) Solution in C++ with no extra space
1
Reply
A
asi.f.khan
10 months ago
Binary Search with Sorting Solution
0
Reply
R
reema-tikadar
11 months ago
Solution without bit manipulation ,T.C.-O(nlogn + n/3),S.C.-O(1)
0
Reply
N
nkg14887_8ab1b428ce3
over 1 year ago
Using JavaScript Object
0
Reply
B
bhanu-the-bruce-lee
over 1 year ago
Simple and Easy - Java
0
Reply
M
mihir-kumar
over 1 year ago
Java(Algo described for other langs)- using kmap to identify how to manipulate bits
0
Reply
R
raunak0258_98ba8b7e6
over 1 year ago
Easier solution using bit manipulation
0
Reply
V
vijendra-saini
over 1 year ago
Best Easiest Cpp, C++ solution
0
Reply
L
leonardo-vinci
almost 2 years ago
First apporch in mind when i see hint
1
Reply
A
archit-tiwari
about 2 years ago
Sort(A.begin(),A.end()) gives error why?
7
Reply
P
pateriyasouravh_3973
over 2 years ago
A non-intuitive approach
0
Reply
A
atishayjain002_e1e41
over 2 years ago
Not a medium level question
0
Reply
S
samarth-gupta_624
over 2 years ago
SImple Solution (Python O(n))
0
Reply
C
charizard-gaming
over 2 years ago
What is the mistake
2
Reply
C
charizard-gaming
over 2 years ago
My code in java simple code and easily understand
0
Reply
S
subham-pandey_827
over 2 years ago
Tc:o(n), sc:o(1) c++ solution
1
Reply
S
shivam2000_7df671abd
almost 3 years ago
C++ || O(N) Time || O(1) Space || Clean code
0
Reply
R
rajesh-panjiyar
almost 3 years ago
C++ solution | TC: O(N) | SC: O(32)
0
Reply
U
udit-kotecha
almost 3 years ago
Hint -> calculate set bit frequency for each position
0
Reply
A
adarsh-kumar_143_906
almost 3 years ago
FInd the error (Quite hard to spot)
2
Reply
N
nawazwarsi
about 3 years ago
TC : O(N) & SC : O(1) with easy & understandable code!
3
Reply
N
n-c-s-jagannath_671
about 3 years ago
Please clear my doubt
1
Reply
G
gyanaranjan-pradhan
almost 4 years ago
Isn't this O(n) time complexity?
2
Reply
K
Kowlutla
about 4 years ago
Accepted Java solution without using Bit Operations
1
Reply
S
sai-github
over 4 years ago
Extra space allocation
4
Reply
S
shubhneet-sandhu
over 4 years ago
Explanation for the hint
2
Reply
2
2018eeb1169_8bdb35f1
almost 5 years ago
Why Bit? Sorting will also do it in O(32N)
1
Reply
K
khagendra-mahato
almost 5 years ago
Expected Output and WA Explaination
1
Reply
Post a comment
This thread is for people who have solved the problem. You may discuss your solutions here.
J
john-denix
6 months ago
Heres a python code for this problem
0
Reply
A
asi.f.khan
10 months ago
By Binary Search with O(nlogn) TC
0
Reply
A
akashkumrawatsdbg_1e
almost 2 years ago
C++ solution bit manipulation
0
Reply
P
praveshrathe_b56b4db
about 2 years ago
Different method other than XOR
0
Reply
2
201901057_a4fe654bdf
almost 3 years ago
Take a look at logic
0
Reply
Z
zuberustad456_0a915a
almost 3 years ago
O(NLOGN) solution using Unordered map
0
Reply
V
vamc_kr
almost 3 years ago
Simple Java Solution using Bit Manipulation
1
Reply
A
aditya-kanojia
almost 3 years ago
Simple Solution using HashMap in Java
0
Reply
U
utkrisht-kumar-singh
almost 3 years ago
Best appproch O(N) sol with SC O(1)
0
Reply
A
ayush-kumar_761
about 3 years ago
Unable to understand given second solution
0
Reply
A
AYUSH-IIT
almost 4 years ago
Oye bete moj kardi 😎
0
Reply
S
satyamprakash2828_64
almost 4 years ago
C++ Bits Solution
0
Reply
S
shiva2kumar06_6eb921
almost 4 years ago
Cpp solution using 2's multiples
0
Reply
S
surya_kant
almost 4 years ago
What is wrong with this solution same version of other is accepted
2
Reply
N
nawnit-sen
almost 4 years ago
Linear solution with constant space
0
Reply
S
stuti-jain_538
almost 4 years ago
Cpp bit manipulation O(n) time O(1) space
0
Reply
2
2019uec1805_00a1013b
about 4 years ago
Easy c++ solution using multiples of 3 concept
0
Reply
A
aravindram756_51b818
about 4 years ago
Title of your commentwhat's wrong with my approach
0
Reply
Y
yunfeng-pi
about 4 years ago
Same logic as in the editorial's solution, but use bit operators instead of arithmetic like sum and power
2
Reply
H
himanshu-mate
over 4 years ago
5 line code in cpp
0
Reply
M
Maimoi
over 4 years ago
C++ O(n) - time O(1) - Space Easy to understand
0
Reply
M
myphone9672_48b26456
over 4 years ago
[C++][Single Number II] short simple code
3
Reply
S
sanyamgoyal2803_0fba
over 4 years ago
N logn solution
0
Reply
U
ubaid-shaikh
over 4 years ago
Simple and Sweet, based on given hint
0
Reply
A
au620
over 4 years ago
TWO LINE O(n) C++ without extra memory
0
Reply
V
vamsiscientist6716
over 4 years ago
Java Easy HashMap
1
Reply
A
adityajaas_bad222626
almost 5 years ago
Can someone explain this ((A[j] >> i) & 1) please?
2
Reply
H
harishreddythalla
almost 5 years ago
Very simple c++ soln(pure bit manipulations):
0
Reply
H
harishreddythalla
almost 5 years ago
Single Number II (easy and intuitive solution)
1
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