leetcode.com 2023-12-12
🟢1464.maximum-product-of-two-elements-in-an-array
🏷️ Tags
#array #sorting #heap_priority_queue
🟢1464.maximum-product-of-two-elements-in-an-array
🏷️ Tags
#array #sorting #heap_priority_queue
Telegraph
maximum-product-of-two-elements-in-an-array
Example 1: Input: nums = [3,4,5,2] Output: 12 Explanation: If you choose the indices i=1 and j=2 (indexed from 0), you will get the maximum value, that is, (nums[1]-1)*(nums[2]-1) = (4-1)*(5-1) = 3*4 = 12. Example 2: Input: nums = [1,5,4,5] Output: 16 Explanation:…
leetcode.cn 2023-12-13
🟢2697.lexicographically-smallest-palindrome
🏷️ Tags
#greedy #two_pointers #string
🟢2697.lexicographically-smallest-palindrome
🏷️ Tags
#greedy #two_pointers #string
Telegraph
lexicographically-smallest-palindrome
给你一个由 小写英文字母 组成的字符串 s ,你可以对其执行一些操作。在一步操作中,你可以用其他小写英文字母 替换 s 中的一个字符。 请你执行 尽可能少的操作 ,使 s 变成一个 回文串 。如果执行 最少 操作次数的方案不止一种,则只需选取 字典序最小 的方案。 对于两个长度相同的字符串 a 和 b ,在 a 和 b 出现不同的第一个位置,如果该位置上 a 中对应字母比 b 中对应字母在字母表中出现顺序更早,则认为 a 的字典序比 b 的字典序要小。 返回最终的回文字符串。 示例 1: 输入:s…
leetcode.com 2023-12-14
🟡2482.difference-between-ones-and-zeros-in-row-and-column
🏷️ Tags
#array #matrix #simulation
🟡2482.difference-between-ones-and-zeros-in-row-and-column
🏷️ Tags
#array #matrix #simulation
Telegraph
difference-between-ones-and-zeros-in-row-and-column
You are given a 0-indexed m x n binary matrix grid. A 0-indexed m x n difference matrix diff is created with the following procedure:
leetcode.cn 2023-12-15
🟡2415.reverse-odd-levels-of-binary-tree
🏷️ Tags
#tree #depth_first_search #breadth_first_search #binary_tree
🟡2415.reverse-odd-levels-of-binary-tree
🏷️ Tags
#tree #depth_first_search #breadth_first_search #binary_tree
Telegraph
reverse-odd-levels-of-binary-tree
给你一棵 完美 二叉树的根节点 root ,请你反转这棵树中每个 奇数 层的节点值。
leetcode.com 2023-12-17
🟡2353.design-a-food-rating-system
🏷️ Tags
#design #hash_table #ordered_set #heap_priority_queue
🟡2353.design-a-food-rating-system
🏷️ Tags
#design #hash_table #ordered_set #heap_priority_queue
Telegraph
design-a-food-rating-system
Design a food rating system that can do the following:
leetcode.com 2023-12-21
🟡1637.widest-vertical-area-between-two-points-containing-no-points
🏷️ Tags
#array #sorting
🟡1637.widest-vertical-area-between-two-points-containing-no-points
🏷️ Tags
#array #sorting
Telegraph
widest-vertical-area-between-two-points-containing-no-points
Given n points on a 2D plane where points[i] = [xi, yi], Return the widest vertical area between two points such that no points are inside the area. A vertical area is an area of fixed-width extending infinitely along the y-axis (i.e., infinite height). The…
leetcode.cn 2023-12-22
🔴1671.minimum-number-of-removals-to-make-mountain-array
🏷️ Tags
#greedy #array #binary_search #dynamic_programming
🔴1671.minimum-number-of-removals-to-make-mountain-array
🏷️ Tags
#greedy #array #binary_search #dynamic_programming
Telegraph
minimum-number-of-removals-to-make-mountain-array
我们定义 arr 是 山形数组 当且仅当它满足: