Skip to main content

15 docs tagged with "Backtracking"

View All Tags

Combination Sum

Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order.

Combination Sum II

Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.

Combination Sum III

Find all valid combinations of k numbers that sum up to n such that the following conditions are true.

Combinations

Given two integers n and k, return all possible combinations of k numbers chosen from the range [1, n].

Generate Parentheses

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

Letter Case Permutation

Given a string s, you can transform every letter individually to be lowercase or uppercase to create another string.

Letter Combinations of a Phone Number

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.

N-Queens

The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.

Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.

Permutations

Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.

Permutations II

Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order.

Subsets

Given an integer array nums of unique elements, return all possible subsets (the power set).

Subsets II

Given an integer array nums that may contain duplicates, return all possible subsets (the power set).

Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells.

Word Search

Given an m x n grid of characters board and a string word, return true if word exists in the grid.