Segment Tree59 Trie55 Combinatorics52 Bitmask49 Queue47 Divide and Conquer47 Recursion46 Memoization42 Binary Indexed Tree41 Geometry40 Binary Search Tree40 Hash Function39 String Matching36 Topological Sort34 Shortest Path33 Rolling Hash30 Game Theory28 Interactive23 Data Stream21 Monotonic Queue18 Brai...
第二部分---树状数组:https://leetcode.com/tag/binary-indexed-tree/ 【218】The Skyline Problem(2019年1月22日) 本题想不出来用树状数组怎么做,最后自己yy出来了一种写法来做。 给了一堆大楼,给了每个楼的坐标和高度,用 (l, r, h) 表示,返回所有的 key points, A key point is the left endpoint...
链接:https://leetcode.cn/problems/range-sum-query-immutable 代码实现 packagecom.company;/*** 1 线段树解题 *@authorweidoudou * @date 2023/1/18 6:47 **/classNumArray { SegmentTree<Integer>segmentTree;publicNumArray(int[] nums) {if(nums.length==0){thrownewIllegalArgumentException("数组长度...
https://leetcode.cn/problems/4sum/ https://leetcode.cn/problems/rectangle-overlap/solutions/1558...
https://leetcode.cn/problems/count-visited-nodes-in-a-directed-graph/description/ 问题分析 初步分析: 对于$n$ 个点 $n$ 条边的有向弱连通图,图中每个点的出度都是 $1$,因此它是一棵 「内向基环树」。那么,对于每个点有 $2$ 种情况:
这道题的另外一种解法就是Lazy Propagation in Segment Tree(线段树的惰性传播)。这个方法来源于leetcode的disscuss中,如下链接。 https://leetcode.com/problems/my-calendar-iii/discuss/214831/Python-13-Lines-Segment-Tree-with-Lazy-Propagation-O(1)-time ...
这道题的另外一种解法就是Lazy Propagation in Segment Tree(线段树的惰性传播)。这个方法来源于leetcode的disscuss中,如下链接。 https://leetcode.com/problems/my-calendar-iii/discuss/214831/Python-13-Lines-Segment-Tree-with-Lazy-Propagation-O(1)-time ...
很多人连Segment Tree,BIT,Trie,Union Find这种数据结构都不懂,遇见就刷,自己想,怎么可能想的出来...
找某段区间的最大值最小值(线段树 SegmentTree 可以解决)O(n)找第k大 (使用快排中的partition操作)...
https://leetcode.com/problems/range-sum-query-mutable/ 线段树的典型题目,参考http://bookshadow.com/weblog/2015/08/13/segment-tree-set-1-sum-of-given-range/ http://bookshadow.com/weblog/2015/11/18/leetcode-range-sum-query-mutable/ ...