$$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Self-defined math definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Math symbol commands \newcommand{\intd}{\,{\rm d}} % Symbol 'd' used in integration, such as 'dx' \newcommand{\diff}{{\rm d}} % Symbol 'd' used in differentiation ... $$
摘要: 题目描述查看:https://leetcode-cn.com/problems/first-missing-positive/ 题目的意思是给定一个无序数组,对数组排序后,缺失的最小正整数。要求时间复杂度O(n),常数级空间复杂度。 时间复杂度是O(n),那么先排序后查找的思路就行不通了,排序算法在 阅读全文
posted @ 2020-03-31 16:52 V丶vvv 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题目描述查看:https://leetcode-cn.com/problems/combination-sum-ii/ 题目的意思是从一个给定的数组中,选出一些数,这些数的和是target。 与39题的区别是,数组中存在重复元素,但是选数的时候不会选选过的数。 1.回溯法 思路 找到回溯结束条件,回 阅读全文
posted @ 2020-03-31 13:05 V丶vvv 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目描述查看:https://leetcode-cn.com/problems/combination-sum/ 题目的意思是从一个给定的数组中,选出一些数,这些数的和是target。 1.回溯法 思路 回溯法有2个关键点,一个是已经选的数,另一个是还能选哪些数。 创建一个List<Integer> 阅读全文
posted @ 2020-03-31 10:12 V丶vvv 阅读(208) 评论(0) 推荐(0) 编辑