摘要: 这个题目本质上是一个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 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(162) 评论(0) 推荐(0) 编辑