All Posts

Leetcode 137: Single Number II

You are given an integer array where every element appears exactly three times, except for one element which appears only once. Find the element that appears only once and return it. The solution must run in linear time complexity and use constant extra space.

Leetcode 190: Reverse Bits

Given a 32-bit unsigned integer, reverse its bits and return the result as an unsigned integer.

Leetcode 191: Number of 1 Bits

Given a positive integer n, return the number of set bits (1s) in its binary representation, also known as the Hamming weight.

Leetcode 201: Bitwise AND of Numbers Range

Given two integers, left and right, representing a range [left, right], you need to calculate the bitwise AND of all numbers within that range, inclusive. The bitwise AND operation takes two numbers and returns a number where each bit is set to 1 if the corresponding bits of both numbers are also 1.

Leetcode 231: Power of Two

Given an integer n, determine if it is a power of two. An integer n is considered a power of two if there exists an integer x such that n == 2^x.

Leetcode 268: Missing Number

Given an array nums containing n distinct numbers, each in the range [0, n], return the only number in the range that is missing from the array.