上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: problem:https://leetcode.com/problems/minimum-domino-rotations-for-equal-row/ 有四种可能性,相等数字为A[0],出现在上面或下面;相等数字为B[0],出现在上面或下面。取这四者最小值即可。 阅读全文
posted @ 2019-08-03 20:04 fish1996 阅读(138) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/construct-quad-tree/ 一道简单的建树题目,模拟即可。 阅读全文
posted @ 2019-08-03 19:02 fish1996 阅读(156) 评论(0) 推荐(0)
摘要: problem: https://leetcode.com/problems/length-of-longest-fibonacci-subsequence/ O(n2), 把已有的a + b = c 结果用hashmap存起来,然后计算当前数字为结尾的最长类斐波那契子序列。 其中,dp[i][j] 阅读全文
posted @ 2019-08-03 18:11 fish1996 阅读(169) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/binary-string-with-substrings-representing-1-to-n/ 暴力枚举了一下所有子字符串可能对应的数字,统计是否达到N个,就过了。不知道有没有更快的方法。 阅读全文
posted @ 2019-08-03 17:14 fish1996 阅读(132) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/knight-dialer 可能是一个比较蠢的dp做法,因为我手动把跳转的方法写成了表: 阅读全文
posted @ 2019-08-03 17:04 fish1996 阅读(268) 评论(0) 推荐(0)
摘要: problem: 一道模拟题,用深搜匹配一下所有情况即可。 阅读全文
posted @ 2019-08-03 14:52 fish1996 阅读(212) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/car-fleet/ 按位置对车进行排序,然后从后往前扫描,判断当前车能否被后面一辆车超越(比较后面的车达到终点用的时间是否更短),如果能,以当前这辆车为基础,再判断下一辆后面的车能否超越它;否则以后面一辆车作为新的比较标准 阅读全文
posted @ 2019-08-03 10:55 fish1996 阅读(168) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/string-to-integer-atoi/ 这题题号挺前的,但一直没做。今天提了5次才过,终于知道这道题为什么通过率这么低了。主要就是if/else练习,尤其是完全没看题后会挂在很多地方。 阅读全文
posted @ 2019-08-02 23:30 fish1996 阅读(103) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/flatten-nested-list-iterator/ 这道题要手动维护栈,对于弱鸡的我写起来真痛苦Orz 阅读全文
posted @ 2019-08-02 22:42 fish1996 阅读(150) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/complete-binary-tree-inserter/ 使用队列来追踪当前可用的父节点,就可以实现快速插入。 阅读全文
posted @ 2019-08-02 16:31 fish1996 阅读(181) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 13 下一页