文章

草祭の博客

回溯算法初探

概念 类似穷举的方法,不断搜索可能解的路径,当发现不满足的条件时,就回溯返回,返回后再继续尝试别的路径。 (如下图示, 为了找到迷宫的出口,不断尝

每日Leetcode03

39. Combination Sum tag. array Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target. The same repeated number may be chosen from candidates unlimited number of times. Example 1: 1 2 3 4 5 6 Input: candidates = [2,3,6,7], target = 7, A solution set is: [ [7], [2,2,3] ] So

每日Leetcode02

35. Search Insert Position tags. Array 向有序列表里找到需要插入值的index,且You may assume no duplicates in the array. Example 1: 1 2 Input: [1,3,5,6], 5 Output: 2 我的Solution: 1 2 3 4 5 6 class Solution: def searchInsert(self, nums: List[int], target: