標籤:: Backtracking

0

Count Numbers with Unique Digits

Count Numbers with Unique DigitsGiven a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10^n. For example:1Given n = 2, return 91. (The answer should be the total nu

0

Combination Sum III

Combination Sum IIIFind all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. Examp

0

Add and Search Word - Data structure design

Add and Search Word - Data structure designDesign a data structure that supports the following two operations: 12void addWord(word)bool search(word) search(word) can search a literal word or a regula

0

Palindrome Partitioning

Palindrome PartitioningGiven a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example:Given s = “aab”,Return 1

0

Restore IP Addresses

Restore IP AddressesGiven a string containing only digits, restore it by returning all possible valid IP address combinations. For example:123Given "25525511135",return ["255.255.11.13

0

Subsets II

Subsets IIGiven a collection of integers that might contain duplicates, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example:If nums = [1,2,2], a

0

Gray Code

Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total number of bits in the code, print the seque

0

Word Search

Word SearchGiven a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or v

0

Subsets

SubsetsGiven a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. For example:If nums = [1,2,3], a solution is: 12345678910[ [3],

0

Combinations

CombinationsGiven two integers n and k, return all possible combinations of k numbers out of 1 … n. For example:If n = 4 and k = 2, a solution is: 12345678[ [2,4], [3,4], [2,3], [1,2], [1,3], [

0

Permutation Sequence

Permutation SequenceThe set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3): “123” “132

0

Permutations II

Permutations IIGiven a collection of numbers that might contain duplicates, return all possible unique permutations. For example:[1,1,2] have the following unique permutations: 12345[ [1,1,2], [1,2

0

Permutations

PermutationsGiven a collection of distinct numbers, return all possible permutations. For example:[1,2,3] have the following permutations: 12345678[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2],

0

Combination Sum II

Combination Sum IIGiven a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may only be used once

0

Combination Sum

Combination SumGiven a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may

0

Generate Parentheses

Generate ParenthesesGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example:Given n = 3, a solution set is: 1234567[ "((()))",

0

Letter Combinations of a Phone Number

Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons)

0

Binary Watch

Binary WatchA binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents a zero or one, with the least signifi