随笔分类 -  数据结构--回溯

摘要:Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. 阅读全文
posted @ 2019-03-12 15:46 乐乐章 阅读(191) 评论(0) 推荐(0)
摘要:216. 组合总和 III labuladong 题解 难度中等 683 找出所有相加之和为 n 的 k 个数的组合,且满足下列条件: 只使用数字1到9 每个数字 最多使用一次 返回 所有可能的有效组合的列表 。该列表不能包含相同的组合两次,组合可以以任何顺序返回。 示例 1: 输入: k = 3, 阅读全文
posted @ 2019-03-12 11:56 乐乐章 阅读(160) 评论(0) 推荐(0)
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations. Example: Input: "25525511135" Output: ["255 阅读全文
posted @ 2019-01-10 22:49 乐乐章 阅读(146) 评论(0) 推荐(0)
摘要:Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 阅读全文
posted @ 2018-04-23 10:39 乐乐章 阅读(344) 评论(0) 推荐(0)
摘要:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all 阅读全文
posted @ 2018-04-23 09:06 乐乐章 阅读(130) 评论(0) 推荐(0)
摘要:40. 组合总和 II labuladong 题解 难度中等 1353 给定一个候选人编号的集合 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。 candidates 中的每个数字在每个组合中只能使用 一次 。 注意:解集 阅读全文
posted @ 2018-04-21 17:46 乐乐章 阅读(128) 评论(0) 推荐(0)
摘要:39. 组合总和 labuladong 题解思路 难度中等 2493 给你一个 无重复元素 的整数数组 candidates 和一个目标整数 target ,找出 candidates 中可以使数字和为目标数 target 的 所有 不同组合 ,并以列表形式返回。你可以按 任意顺序 返回这些组合。 阅读全文
posted @ 2018-04-21 17:26 乐乐章 阅读(169) 评论(0) 推荐(0)
摘要: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], 阅读全文
posted @ 2018-04-21 16:24 乐乐章 阅读(146) 评论(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. For exampl 阅读全文
posted @ 2018-02-18 16:20 乐乐章 阅读(213) 评论(0) 推荐(0)