Description
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
Example:
Input: "25525511135" Output: ["255.255.11.135", "255.255.111.35"]
Given a string containing only digits, restore it by returning all possible valid IP address combinations.
Example:
Input: "25525511135" Output: ["255.255.11.135", "255.255.111.35"]
Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).
Note: The solution set must not contain duplicate subsets.
Example:
Input: [1,2,2] Output: [ [2], [1], [1,2,2], [2,2], [1,2], [] ]
Given 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 vertically neighboring. The same letter cell may not be used more than once.
Example:
board =
[
['A','B','C','E'],
['S','F','C','S'],
['A','D','E','E']
]
Given word = "ABCCED", return true.
Given word = "SEE", return true.
Given word = "ABCB", return false.
在board
中查找是否存在相连(相邻)的字符与给定的单词对应。
很像一个走迷宫的题目,搜索下一步是否与单词的字母匹配,是则走到该位置。
Given two integers n and k, return all possible combinations of k numbers out of 1 … n.
Example:
Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ]
给出两个整数n
和k
,输出所有包含k
个数字的组合,数字范围1..n
。
The 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 for n = 3:
"123"
"132"
"213"
"231"
"312"
"321"
Given
n
andk
, return thek-th
permutation sequence.Note:
- Given n will be between 1 and 9 inclusive.
- Given k will be between 1 and n! inclusive.
Example 1:
Input: n = 3, k = 3 Output: "213"
Example 2:
Input: n = 4, k = 9 Output: "2314"
假设存在长度为n
的数组:[1,2,3,...,n]
,输出第k
个排列。
Given a collection of candidate numbers (
candidates
) and a target number (target
), find all unique combinations in candidates where thecandidate
numbers sums totarget
.Each number in
candidates
may only be used once in the combination.Note:
All numbers (including
target
) will be positive integers. The solution set must not contain duplicate combinations.
Given a set of candidate numbers (
candidates
) (without duplicates) and a target number (target
), find all unique combinations incandidates
where the candidate numbers sums totarget
.The same repeated number may be chosen from candidates unlimited number of times.
Note:
- All numbers (including
target
) will be positive integers.- The solution set must not contain duplicate combinations.