2019年1月16日

Leetcode 803. Bricks Falling When Hit

摘要: Problem: We have a grid of 1s and 0s; the 1s in a cell represent bricks. A brick will not drop if and only if it is directly connected to the top of t 阅读全文

posted @ 2019-01-16 16:01 周浩炜 阅读(255) 评论(0) 推荐(0) 编辑

区间最值查询问题

摘要: 基本思想: 该问题要求我们以较低的时间复杂度查询一段区间中的最值。最暴力的解法是将所有可能的区间序列化作为一个哈希表的键进行存储,值为区间内的最值,这样预处理的时间复杂度为O(n2),查询时间复杂度为O(1)。但这样不适用于对数组元素进行更新的操作,和getRangeSum的问题一样,这样子它的更新 阅读全文

posted @ 2019-01-16 04:59 周浩炜 阅读(529) 评论(0) 推荐(0) 编辑

导航