Assignment
Assignment
Single NumberUnsolved
Asked in:
SH
TO
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
Problem Description
Given an array of integers A, every element appears twice except for one. Find that
integer that occurs once.
NOTE: Your algorithm should have a linear runtime complexity. Could you implement it
without using extra memory?
Problem Constraints
Input Format
Output Format
Example Input
Input 1:
A = [1, 2, 2, 3, 1]
Input 2:
A = [1, 2, 2]
Example Output
Output 1:
Output 2:
Example Explanation
Explanation 1:
3 occurs once.
Explanation 2:
1 occurs once.
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
Problem Description
Write a function that takes an integer and returns the number of 1 bits it has.
Problem Constraints
Input Format
Output Format
Example Input
Input1:
11
Example Output
Output1:
3
Example Explanation
Explaination1:
11 is represented as 1011 in binary.