Backtracking
文章平均质量分 51
yuanhisn
这个作者很懒,什么都没留下…
展开
-
LeetCode 17 - Letter Combinations of a Phone Number
Given 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) is given below. Input:Digit stri...原创 2015-02-15 01:28:22 · 48 阅读 · 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 ...原创 2015-04-12 06:25:15 · 55 阅读 · 0 评论 -
LeetCode 39 - Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C unlimited number ...原创 2015-03-25 03:29:31 · 49 阅读 · 0 评论 -
Facebook interview - Prime Number Combination Product
给一个质数数组,返回所有可能的product,顺序不管 比如给 [2,3,5] 返回 [2,3,5,6,10,15,30] 数组中的数如果有重复则需要去重,不允许用set。 比如给 [2,2,2] 返回 [2,4,8],顺序不用管。 public List<Integer> combinePrimeProduct(int[] primes) { Arrays.so...原创 2015-03-13 00:18:50 · 96 阅读 · 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: "((()))", "(()())", "(())()", "()(())", "()()()...原创 2015-03-12 05:14:00 · 49 阅读 · 0 评论 -
LeetCode 10 - Regular Expression Matching
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire inp...原创 2015-03-02 08:13:27 · 54 阅读 · 0 评论 -
LeetCode 37 - Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character '.'. You may assume that there will be only one unique solution. A sudoku puzzle....原创 2015-02-16 00:32:50 · 66 阅读 · 0 评论 -
LeetCode 46 - Permutations
Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1]. public List<List...原创 2015-08-04 00:36:32 · 94 阅读 · 0 评论