backtracking
Vendredimatin
这个作者很懒,什么都没留下…
展开
-
Leetcode 212. Word Search II
Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizo...原创 2020-02-15 12:37:41 · 135 阅读 · 0 评论 -
Leetcode backtracking Top interview Question 7道题总结
本篇文章是对leetcode tree和Top Interview Questions标签下7道backtracking类型题目的总结Leetcode 46. Permuation求一个数组的排列,不断加入新的元素递归,递归结束后删去,并在新一轮循环中同一个位置加入新的元素Leetcode 22. Generate Parentheses求(和)的排列,思路同上,只是要满足左括号和右括号的...原创 2020-02-14 11:38:02 · 227 阅读 · 0 评论 -
Leetcode 140. Word Break II
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible ...原创 2020-02-14 11:17:40 · 115 阅读 · 0 评论 -
Leetcode 131. 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.Example:Input: “aab”Output:[[“aa”,“b”],[“a”,“a”,“b”]]...原创 2020-02-14 11:06:02 · 100 阅读 · 0 评论 -
Leetcode 17. 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.A mapping of digit to letters (just like on the telephone buttons) is give...原创 2020-02-14 10:56:07 · 99 阅读 · 0 评论 -
Leetcode 22. Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[“((()))”,“(()())”,“(())()”,“()(())”,“()()()”...原创 2020-02-14 10:36:16 · 74 阅读 · 0 评论 -
Leetcode 46/47/31/60 Permutations 专题
Leetcode 46 PermutationsGiven a collection of distinct integers, return all possible permutations.Example:Input: [1,2,3]Output:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]求给定数组的所有排列,...原创 2020-02-14 10:30:58 · 135 阅读 · 0 评论 -
leetcode 79. Word Search
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 ne...原创 2019-06-15 16:04:11 · 136 阅读 · 0 评论 -
Leetcode 78. Subsets
Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:[[3],[1],[2],...原创 2019-06-04 21:01:29 · 165 阅读 · 0 评论