随笔分类 - Backtracking
发表于 2019-03-14 18:46阅读:237评论:0推荐:0
摘要:Given an array of integers nums and a positive integer k, find whether it's possible to divide this array into k non-empty subsets whose sums are all
阅读全文 »
发表于 2019-02-09 00:29阅读:194评论:0推荐:0
摘要:Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. Except for the f
阅读全文 »
发表于 2019-02-06 23:49阅读:384评论:0推荐:0
摘要:We are given N different types of stickers. Each sticker has a lowercase English word on it. You would like to spell out the given target string by cu
阅读全文 »
发表于 2019-02-06 23:04阅读:235评论:0推荐:0
摘要:Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these N numbers successfully if one of t
阅读全文 »
发表于 2019-02-06 00:38阅读:198评论:0推荐:0
摘要:A 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
阅读全文 »
发表于 2019-02-05 23:32阅读:250评论:0推荐:0
摘要:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example: Input: 2 Output: 91 Explanation: The answer shoul
阅读全文 »
发表于 2019-02-05 23:02阅读:179评论:0推荐:0
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: I
阅读全文 »
发表于 2019-02-01 22:50阅读:145评论:0推荐:0
摘要:Find 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
阅读全文 »
发表于 2018-10-28 21:45阅读:195评论:0推荐:0
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations. Example: AC code: Runtime: 4 ms, faster tha
阅读全文 »
发表于 2018-10-28 16:49阅读:297评论:0推荐:0
摘要:Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not conta
阅读全文 »
发表于 2018-10-24 15:47阅读:224评论:0推荐:0
摘要: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 "adjac
阅读全文 »
发表于 2018-10-15 22:00阅读:184评论:0推荐:0
摘要:Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numb
阅读全文 »
发表于 2018-10-15 21:30阅读:196评论:0推荐:0
摘要:Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the
阅读全文 »