上一页 1 ··· 7 8 9 10 11 12 13 下一页
摘要: problem:https://leetcode.com/problems/binary-tree-pruning/ 一道非常简单的tree题目,根据题意模拟剔除不包含0的子树即可。 阅读全文
posted @ 2019-08-02 12:04 fish1996 阅读(88) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/max-consecutive-ones-iii/ 维护最多包含k个0的滑动窗口,一旦超过了k个0,把队首的0 pop出来。不断更新当前滑动窗口中的数据个数,并取最大值返回即可。 阅读全文
posted @ 2019-08-02 12:01 fish1996 阅读(143) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/online-election/ 二分搜索题,主要是根据时间来二分,先预先计算好当前时间点对应的选举人,存到hashmap中。之后通过二分找到时间,再通过hash找到对应选举人。 阅读全文
posted @ 2019-08-01 21:48 fish1996 阅读(337) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/reveal-cards-in-increasing-order/ 我的思路先排序,然后反向模拟整个过程,按从大大小的顺序放入数据,每次放入之前,把最后一个数字挪到前面来。 阅读全文
posted @ 2019-08-01 20:37 fish1996 阅读(141) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/interleaving-string/ 我用的方法是记忆搜索,直接尝试模拟匹配的过程,速度比较慢。 阅读全文
posted @ 2019-08-01 20:21 fish1996 阅读(150) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/array-nesting/ 这道题有点类似于找最大的连通子图,只不过是以数组来表示的,难度并不高。 阅读全文
posted @ 2019-08-01 20:16 fish1996 阅读(127) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/sudoku-solver 一道用dfs纯模拟的题目,每个空白先填一个可能的数字(行列方格都没出现的),先一直这么尝试把所有空白填满,到了没有数字可填的时候,就回退到上一步。通过不断地尝试,最终“试”出最终的答案。 阅读全文
posted @ 2019-08-01 14:40 fish1996 阅读(158) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/3sum-closest/ xxsum是一个系列的题了,一般有二分搜索和哈希两种方法,这道题要求的是接近值,所以哈希就不起作用了,只能使用二分搜索。 对于排好序的数组,首先确定三个数位置在中间的那个数字,然后在它左右搜索另外 阅读全文
posted @ 2019-08-01 11:30 fish1996 阅读(121) 评论(0) 推荐(0)
摘要: problem:https://leetcode.com/problems/permutation-in-string/ 这道题感觉几乎和Leetcode上另一题一模一样,昨天刚刷的:https://www.cnblogs.com/fish1996/p/11269526.html,就当签到题爽一爽了 阅读全文
posted @ 2019-07-31 20:57 fish1996 阅读(139) 评论(0) 推荐(0)
摘要: 之前面试的问题被问到了这个,一脸懵逼。毕竟系统库还挺好用的……因此刚刚花了点时间忙写了一个作为练习(最小堆),没有做越界判断。 阅读全文
posted @ 2019-07-31 15:46 fish1996 阅读(538) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 下一页