09 2019 档案
826. Most Profit Assigning Work
摘要:这题讲的是 每个worker 只能做比他能力难度小的或者一样的工作, 每个工作创造的价值不同,为workers 们能创造的最高价值。 比如worker0 = 4, diff = {1,3,4} profit= {100,10,10} 那这个worker 显然要挑选 100这个高的profit 去做。 阅读全文
posted @ 2019-09-30 02:51 KeepAC 阅读(195) 评论(0) 推荐(0)
457. Circular Array Loop --类似BFS 和快慢指针
摘要:这个题目本质上是一个graph 的BFS 题目,虽然光度题目很难看出来。 数组里是的value 表示走几步,负数表示往回走. “If a number k at an index is positive, then move forward k steps. Conversely, if it's 阅读全文
posted @ 2019-09-29 14:11 KeepAC 阅读(155) 评论(0) 推荐(0)
11 Container With Most Water 42.Trapping Rain Water
摘要:11 和 42 本质上都是木桶原理: 11 如何才能存最多的水? 假设 a[left] < a[right] , total = a[left] *(right-left) , 那么 right -1, right-2 位置 都比 total 小, 此时就没必要move right 了, 因为所有的 阅读全文
posted @ 2019-09-29 05:12 KeepAC 阅读(176) 评论(0) 推荐(0)
392 Is Subsequence 521/522. Longest Uncommon Subsequence II 524. Longest Word in Dictionary through Deleting
摘要:392 是一个easy题, 就是问 s 是否能由t 构成。 当然不能把 t 的 所有2^n个子串都拿出来,一一和s比较。 只需要two points就行了。 Example 1:s = "abc", t = "ahbgdc" 这道题很简单,但写出的code 可能差别很大,看看我第一次提交的code 阅读全文
posted @ 2019-09-27 15:33 KeepAC 阅读(150) 评论(0) 推荐(0)