随笔分类 -  Array

数组、极值
[Leetcode 452] 最少需要射出多少支箭Minimum Number of Arrows to Burst Balloons 贪心 重载
摘要:【题目】 There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of th 阅读全文
posted @ 2018-11-28 14:15 alau 阅读(142) 评论(0) 推荐(0)
[Leetcode 18]四数之和 4 Sum
摘要:【题目】 Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all uni 阅读全文
posted @ 2018-11-18 14:46 alau 阅读(146) 评论(0) 推荐(0)
[Leetcode 46]全排列 Permutations 递归
摘要:【题目】 Given a collection of distinct integers, return all possible permutations. 数组的组合情况。 【思路】 求子集,排列组合的数组题有固定模板。 【代码】 阅读全文
posted @ 2018-11-17 23:06 alau 阅读(123) 评论(0) 推荐(0)
[Leetcode 90]求含有重复数的子集 Subset II
摘要:【题目】 Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not 阅读全文
posted @ 2018-11-17 22:52 alau 阅读(208) 评论(0) 推荐(0)
[Leetcode 78]求子集 Subset
摘要:【题目】 Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. 求 阅读全文
posted @ 2018-11-17 22:41 alau 阅读(311) 评论(0) 推荐(0)
[Leetcode 15]三数之和 3 Sum
摘要:【题目】 Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives 阅读全文
posted @ 2018-11-13 23:44 alau 阅读(146) 评论(0) 推荐(0)
[leetcode121]股票买卖 Best Time to Buy and Sell Kadane算法
摘要:【题目】 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transa 阅读全文
posted @ 2018-11-05 11:46 alau 阅读(141) 评论(0) 推荐(0)