IncredibleThings

导航

2018年11月19日 #

LeetCode - Fruit Into Baskets

摘要: 用 two points 去维护一个 window, 注意一些coner case 阅读全文

posted @ 2018-11-19 11:54 IncredibleThings 阅读(180) 评论(0) 推荐(0)

LeetCode - Online Election

摘要: 所以这个题使用List保存每个时间点对应的当前的获得票数最多的person。在q(t)中,使用二分查找到第一个小于t的times位置,然后返回这个位置对应的时间得票最多的person即可。 平均的时间复杂度是O(logn),空间复杂度是O(N). 阅读全文

posted @ 2018-11-19 06:44 IncredibleThings 阅读(175) 评论(0) 推荐(0)

LeetCode - X of a Kind in a Deck of Cards

摘要: 这道题仔细分析之后会得到X 一定得能被deck.length整除,也一定得被每个元素出现的次数整除,才能return true 阅读全文

posted @ 2018-11-19 00:28 IncredibleThings 阅读(138) 评论(0) 推荐(0)