Practice · 10 problems
Math & Bits
0 of 10 solved on this device
- 046Single NumberGiven a non-empty array where every element appears twice except for one, find that single element. Must run in O(n) time using O(1) extra space.Easy
- 047Counting BitsGiven an integer `n`, return an array of length n + 1 where ans[i] is the number of 1-bits in the binary representation of i.Easy
- 048Reverse IntegerGiven a signed 32-bit integer `x`, return x with its digits reversed. If reversing causes the value to fall outside [-2^31, 2^31 - 1], return 0.Medium
- 049Pow(x, n)Implement pow(x, n), which computes x raised to the power n. `n` may be negative.Medium
- 050Rotate ImageGiven an n x n 2D matrix representing an image, rotate it 90 degrees clockwise. You must rotate it IN PLACE — do not allocate another matrix.Medium
- 088Number of 1 BitsWrite a function that takes an unsigned integer and returns its Hamming weight: the number of 1 bits in its binary representation.Easy
- 089Missing NumberGiven an array `nums` containing n distinct numbers drawn from the range [0, n], return the one number in that range that is missing. Aim for O(n) time and O(1) extra space.Easy
- 090Plus OneYou are given a large integer as an array of digits, most significant digit first, with no leading zeros. Increment it by one and return the resulting digit array.Easy
- 127Reverse BitsReverse the bits of a given 32-bit unsigned integer and return the result.Easy
- 128Sum of Two IntegersGiven two integers `a` and `b`, return their sum WITHOUT using the + or - operators.Medium