218.the-skyline-problem.pdf
210.7 KB
leetcode.com 2022-09-30
🔴218.the-skyline-problem
🏷️ Tags
#array #divide_and_conquer #binary_indexed_tree #segment_tree #line_sweep #heap_priority_queue #ordered_set
🔴218.the-skyline-problem
🏷️ Tags
#array #divide_and_conquer #binary_indexed_tree #segment_tree #line_sweep #heap_priority_queue #ordered_set
918.maximum-sum-circular-subarray.pdf
77 KB
leetcode.com 2023-01-18
🟡918.maximum-sum-circular-subarray
🏷️ Tags
#array #divide_and_conquer #dynamic_programming #queue #monotonic_queue
🟡918.maximum-sum-circular-subarray
🏷️ Tags
#array #divide_and_conquer #dynamic_programming #queue #monotonic_queue
912.sort-an-array.pdf
58.9 KB
leetcode.com 2023-03-01
🟡912.sort-an-array
🏷️ Tags
#array #divide_and_conquer #sorting #heap_priority_queue #merge_sort #bucket_sort #radix_sort #counting_sort
🟡912.sort-an-array
🏷️ Tags
#array #divide_and_conquer #sorting #heap_priority_queue #merge_sort #bucket_sort #radix_sort #counting_sort
109.convert-sorted-list-to-binary-search-tree.pdf
106.1 KB
leetcode.com 2023-03-11
🟡109.convert-sorted-list-to-binary-search-tree
🏷️ Tags
#linked_list #divide_and_conquer #tree #binary_search_tree #binary_tree
🟡109.convert-sorted-list-to-binary-search-tree
🏷️ Tags
#linked_list #divide_and_conquer #tree #binary_search_tree #binary_tree
23.merge-k-sorted-lists.pdf
66.1 KB
leetcode.com 2023-03-12
🔴23.merge-k-sorted-lists
🏷️ Tags
#linked_list #divide_and_conquer #heap_priority_queue #merge_sort
🔴23.merge-k-sorted-lists
🏷️ Tags
#linked_list #divide_and_conquer #heap_priority_queue #merge_sort
106_construct_binary_tree_from_inorder_and_postorder_traversal.pdf
71.3 KB
leetcode.com 2023-03-16
🟡106.construct-binary-tree-from-inorder-and-postorder-traversal
🏷️ Tags
#array #hash_table #divide_and_conquer #tree #binary_tree
🟡106.construct-binary-tree-from-inorder-and-postorder-traversal
🏷️ Tags
#array #hash_table #divide_and_conquer #tree #binary_tree
leetcode.com 2023-05-22
🟡347.top-k-frequent-elements
🏷️ Tags
#array #hash_table #divide_and_conquer #bucket_sort #counting #quickselect #sorting #heap_priority_queue
🟡347.top-k-frequent-elements
🏷️ Tags
#array #hash_table #divide_and_conquer #bucket_sort #counting #quickselect #sorting #heap_priority_queue
Telegraph
top-k-frequent-elements
Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Example 2: Input: nums = [1], k = 1 Output: [1] Constraints:
leetcode.com 2023-06-16
🔴1569.number-of-ways-to-reorder-array-to-get-same-bst
🏷️ Tags
#tree #union_find #binary_search_tree #memoization #array #math #divide_and_conquer #dynamic_programming #binary_tree #combinatorics
🔴1569.number-of-ways-to-reorder-array-to-get-same-bst
🏷️ Tags
#tree #union_find #binary_search_tree #memoization #array #math #divide_and_conquer #dynamic_programming #binary_tree #combinatorics
Telegraph
number-of-ways-to-reorder-array-to-get-same-bst
Given an array nums that represents a permutation of integers from 1 to n. We are going to construct a binary search tree (BST) by inserting the elements of nums in order into an initially empty BST. Find the number of different ways to reorder nums so that…
leetcode.cn 2023-07-20
🟡918.maximum-sum-circular-subarray
🏷️ Tags
#queue #array #divide_and_conquer #dynamic_programming #monotonic_queue
🟡918.maximum-sum-circular-subarray
🏷️ Tags
#queue #array #divide_and_conquer #dynamic_programming #monotonic_queue
Telegraph
maximum-sum-circular-subarray
给定一个长度为 n 的环形整数数组 nums ,返回 nums 的非空 子数组 的最大可能和 。 环形数组 意味着数组的末端将会与开头相连呈环状。形式上, nums[i] 的下一个元素是 nums[(i + 1) % n] , nums[i] 的前一个元素是 nums[(i - 1 + n) % n] 。 子数组 最多只能包含固定缓冲区 nums 中的每个元素一次。形式上,对于子数组 nums[i], nums[i + 1], ..., nums[j] ,不存在 i <= k1, k2 <= j 其中 k1…
leetcode.cn 2023-08-12
🔴23.merge-k-sorted-lists
🏷️ Tags
#linked_list #divide_and_conquer #heap_priority_queue #merge_sort
🔴23.merge-k-sorted-lists
🏷️ Tags
#linked_list #divide_and_conquer #heap_priority_queue #merge_sort
Telegraph
merge-k-sorted-lists
给你一个链表数组,每个链表都已经按升序排列。 请你将所有链表合并到一个升序链表中,返回合并后的链表。 示例 1: 输入:lists = [[1,4,5],[1,3,4],[2,6]] 输出:[1,1,2,3,4,4,5,6] 解释:链表数组如下: [ 1->4->5, 1->3->4, 2->6 ] 将它们合并到一个有序链表中得到。 1->1->2->3->4->4->5->6 示例 2: 输入:lists = [] 输出:[] 示例 3: 输入:lists = [[]] 输出:[] 提示:
leetcode.com 2023-08-14
🟡215.kth-largest-element-in-an-array
🏷️ Tags
#array #divide_and_conquer #quickselect #sorting #heap_priority_queue
🟡215.kth-largest-element-in-an-array
🏷️ Tags
#array #divide_and_conquer #quickselect #sorting #heap_priority_queue
Telegraph
kth-largest-element-in-an-array
Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the kth distinct element. Can you solve it without sorting? Example 1: Input: nums = [3,2,1,5,6,4]…
leetcode.com 2023-09-21
🔴4.median-of-two-sorted-arrays
🏷️ Tags
#array #binary_search #divide_and_conquer
🔴4.median-of-two-sorted-arrays
🏷️ Tags
#array #binary_search #divide_and_conquer
Telegraph
median-of-two-sorted-arrays
Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: Input: nums1 = [1,3], nums2 = [2] Output: 2.00000 Explanation: merged array…
leetcode.com 2025-02-23
🟡889.construct-binary-tree-from-preorder-and-postorder-traversal
🏷️ Tags
#tree #array #hash_table #divide_and_conquer #binary_tree
🟡889.construct-binary-tree-from-preorder-and-postorder-traversal
🏷️ Tags
#tree #array #hash_table #divide_and_conquer #binary_tree
Telegraph
construct-binary-tree-from-preorder-and-postorder-traversal
Given two integer arrays, preorder and postorder where preorder is the preorder traversal of a binary tree of distinct values and postorder is the postorder traversal of the same tree, reconstruct and return the binary tree. If there exist multiple answers…
leetcode.cn 2025-04-15
🔴2179.count-good-triplets-in-an-array
🏷️ Tags
#binary_indexed_tree #segment_tree #array #binary_search #divide_and_conquer #ordered_set #merge_sort
🔴2179.count-good-triplets-in-an-array
🏷️ Tags
#binary_indexed_tree #segment_tree #array #binary_search #divide_and_conquer #ordered_set #merge_sort
Telegraph
count-good-triplets-in-an-array
给你两个下标从 0 开始且长度为 n 的整数数组 nums1 和 nums2 ,两者都是 [0, 1, ..., n - 1] 的 排列 。 好三元组 指的是 3 个 互不相同 的值,且它们在数组 nums1 和 nums2 中出现顺序保持一致。换句话说,如果我们将 pos1v 记为值 v 在 nums1 中出现的位置,pos2v 为值 v 在 nums2 中的位置,那么一个好三元组定义为 0 <= x, y, z <= n - 1 ,且 pos1x < pos1y < pos1z 和 pos2x < pos2y…
leetcode.com 2025-04-15
🔴2179.count-good-triplets-in-an-array
🏷️ Tags
#binary_indexed_tree #segment_tree #array #binary_search #divide_and_conquer #ordered_set #merge_sort
🔴2179.count-good-triplets-in-an-array
🏷️ Tags
#binary_indexed_tree #segment_tree #array #binary_search #divide_and_conquer #ordered_set #merge_sort
Telegraph
count-good-triplets-in-an-array
You are given two 0-indexed arrays nums1 and nums2 of length n, both of which are permutations of [0, 1, ..., n - 1]. A good triplet is a set of 3 distinct values which are present in increasing order by position both in nums1 and nums2. In other words, if…
👍1