1.
Add Binary (Easy)
Given two binary strings a
and b
, return their sum as a binary string.
a
and b
consist only of '0'
or '1'
characters.
2.
Reverse Bits (Easy)
Reverse bits of a given 32 bits unsigned integer.
The input must be a binary string of length 32
.
Example:
Input: n = 00000010100101000001111010011100
Output: 964176192 (00111001011110000010100101000000)
3.
Number of 1 Bits (Easy)
Write a function that takes the binary representation of a positive integer and returns the number of set bits it has (also known as the Hamming weight).
4.
Single Number (Easy)
Given a non-empty array of integers nums
, every element appears twice except for one. Find that single one.
Implement a solution with a linear runtime complexity and use only constant extra space.