- 博客(9)
- 资源 (2)
- 收藏
- 关注
原创 LeetCode—368. Largest Divisible Subset
Largest Divisible Subset思路:好的方法肯定是动态规划,然而并不知道怎么获得最后的数组,我只能用动态规划获得长度,所以换了一种方法。首先对nums进行排序操作,然后建立一个List>,里面装所有符合条件的数组,每次新来一个数,扫描整个list,跟每个list最后一个元素做整除比较,如果有符合条件的,选择最长的一个进行复制,添加该元素,然后将list放进整个大list中
2016-06-27 17:20:41 1159
原创 LeetCode—367. Valid Perfect Square
Valid Perfect Square思路:牛顿二分法,注意边界判定。GitHub地址:https://github.com/corpsepiges/leetcode点此进入public class Solution { public boolean isPerfectSquare(int num) { int x=num; w
2016-06-27 10:42:43 351
原创 LeetCode—365. Water and Jug Problem
Water and Jug Problem思路:能否合法取决于2个条件:1.两个容器的和是否大于等于目标值,2.目标值是否能被2个容器的最大公约数整除GitHub地址:https://github.com/corpsepiges/leetcode点此进入public class Solution { public boolean canMeasureWater(
2016-06-27 10:25:36 356
原创 LeetCode—357. Count Numbers with Unique Digits
363. Max Sum of Rectangle No Larger Than K My SubmissionsQuestionEditorial SolutionTotal Accepted: 302 Total Submissions: 1295 Difficulty: HardGiven a non-empty 2D matrix mat
2016-06-23 15:57:44 283
原创 LeetCode—8. String to Integer (atoi)
8. String to Integer (atoi) My SubmissionsQuestionEditorial SolutionTotal Accepted: 106331 Total Submissions: 783579 Difficulty: EasyImplement atoi to convert a string to an
2016-06-14 11:46:59 343
原创 LeetCode—357. Count Numbers with Unique Digits
思路:题目要求找到所有没有重复数字构成的数,分解问题考虑:n位数包含了n-1位提供的所有答案,也就是说只要考虑n位数的情况。在所有的n-1位数提供的答案中,n位数不重复的等于n-1位数的总和*(11-n),比如2位数,可以补充的选择是8个(则n-1=2;补充的数是10-2=8)public class Solution { List list;
2016-06-13 09:33:39 745
原创 LeetCode—355. Design Twitter
思路:建立2个List存储Twitter信息(userId和twitterId),建立一个map>存储follow信息(默认必须存储自己的,当然可以在get的时候添加自己的),剩下的就是一些细节问题,按照题目的意思来。GitHub地址:https://github.com/corpsepiges/leetcode有Java版本和Python版本,求star。
2016-06-12 11:45:25 556
原创 LeetCode—354. Russian Doll Envelopes
思路:对二维数组进行排序,原则是保证在前面的信封无法装后面的信封。GitHub地址:https://github.com/corpsepiges/leetcode有Java版本和Python版本,求star。public class Solution { public int maxEnvelopes(int[][] envelope
2016-06-07 16:09:52 866
原创 LeetCode—352. Data Stream as Disjoint Intervals
思路:设定3个map,finsh(装载已add过的数据),before(add的val-1),end(add的val+1),list中存储答案finish中get(val)不为null,则处理,为null则不处理before和end同时不为null,取出前后Interval,list中删掉前Interval,后Interval的start=前Interval的start。删除end的数据,
2016-06-01 15:38:05 722
2积分系列——经典算法与人工智能在外卖物流调度中的应用
2018-04-26
Outlier Analysis 2nd Edition.pdf ——2积分系列
2018-03-28
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人