All Posts

Leetcode 77: Combinations

You are given two integers n and k. Find all possible combinations of k numbers selected from the range [1, n], where the numbers are chosen without repetition. The answer should contain all possible combinations of k numbers in any order.

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 79: Word Search

You are given a 2D grid board containing characters and a string word. The task is to determine whether the given word can be formed by starting at any cell in the grid and moving to adjacent cells, which are horizontally or vertically neighboring. The same cell cannot be reused in forming the word.

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 95: Unique Binary Search Trees II

Given an integer n, return all structurally unique binary search trees (BSTs) that can be constructed using the integers from 1 to n. Each tree should be a unique arrangement of nodes where each node contains a unique value from the set {1, 2, …, n}.