All Posts

Leetcode 29: Divide Two Integers

Given two integers dividend and divisor, divide dividend by divisor without using multiplication, division, or modulus operators. Truncate the result towards zero and return the quotient.

Leetcode 67: Add Binary

You are given two binary strings, a and b. Each string represents a binary number. Your task is to compute their sum and return it as a binary string.

Leetcode 78: Subsets

You are given an integer array nums containing unique elements. Find all possible subsets (the power set) of the array nums. The solution set should not contain duplicate subsets, and the result can be returned in any order.

Leetcode 89: Gray Code

Given an integer n, generate an n-bit Gray code sequence. A Gray code sequence is a sequence of integers where each integer’s binary representation differs from the next one by exactly one bit. The first integer in the sequence is always 0, and every integer appears only once in the sequence. The binary representation of the first and last integers should also differ by exactly one bit.

Leetcode 90: Subsets II

Given an integer array nums that may contain duplicates, return all possible subsets (the power set) of the array. The solution set should not contain duplicate subsets. The subsets should be returned in any order.

Leetcode 136: Single Number

Given a non-empty array of integers where every element appears twice except for one element that appears once, find the single element that appears only once. The solution must have linear time complexity and use only constant space.