Skip to main content

3 docs tagged with "bit-manipulation"

View All Tags

136. Single Number

Given a non-empty array of integers `nums`, every element appears twice except for one. Find that single one.

191. Number of 1 Bits

Write a function that takes the binary representation of an unsigned integer and returns the number of `1` bits it has (also known as the Hamming weight).

338. Counting Bits

Given an integer `n`, return an array `ans` of length `n + 1` such that for each `i` (0 <= i <= n), `ans[i]` is the number of 1's in the binary representation of `i`.