Question DSA-BIT-0054
MediumEvery element appears three times except one, which appears once. How can the single one be found in O(1) extra space?
- A.
Sort and scan
- B.
Use a hash set
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Bit Manipulation question
Every element appears three times except one, which appears once. How can the single one be found in O(1) extra space?
Sort and scan
Use a hash set
Sign up free to see the answer and a step-by-step explanation.
XOR all elements
Count each bit position modulo 3