leetcode.com 2023-12-09
🟢94.binary-tree-inorder-traversal
🏷️ Tags
#stack #tree #depth_first_search #binary_tree
🟢94.binary-tree-inorder-traversal
🏷️ Tags
#stack #tree #depth_first_search #binary_tree
Telegraph
binary-tree-inorder-traversal
Given the root of a binary tree, return the inorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [1,3,2] Example 2: Input: root = [] Output: [] Example 3: Input: root = [1] Output: [1] Constraints:
leetcode.cn 2023-12-11
🟡1631.path-with-minimum-effort
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
🟡1631.path-with-minimum-effort
🏷️ Tags
#depth_first_search #breadth_first_search #union_find #array #binary_search #matrix #heap_priority_queue
Telegraph
path-with-minimum-effort
你准备参加一场远足活动。给你一个二维 rows x columns 的地图 heights ,其中 heights[row][col] 表示格子 (row, col) 的高度。一开始你在最左上角的格子 (0, 0) ,且你希望去最右下角的格子 (rows-1, columns-1) (注意下标从 0 开始编号)。你每次可以往 上,下,左,右 四个方向之一移动,你想要找到耗费 体力 最小的一条路径。 一条路径耗费的 体力值 是路径上相邻格子之间 高度差绝对值 的 最大值 决定的。 请你返回从左上角走到右下角的最小 体力消耗值 。…
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: