leetcode.cn 2023-09-06
🟡1123.lowest-common-ancestor-of-deepest-leaves
🏷️ Tags
#tree #depth_first_search #breadth_first_search #hash_table #binary_tree
🟡1123.lowest-common-ancestor-of-deepest-leaves
🏷️ Tags
#tree #depth_first_search #breadth_first_search #hash_table #binary_tree
Telegraph
lowest-common-ancestor-of-deepest-leaves
给你一个有根节点 root 的二叉树,返回它 最深的叶节点的最近公共祖先 。 回想一下:
leetcode.com 2023-09-10
🔴1359.count-all-valid-pickup-and-delivery-options
🏷️ Tags
#math #dynamic_programming #combinatorics
🔴1359.count-all-valid-pickup-and-delivery-options
🏷️ Tags
#math #dynamic_programming #combinatorics
Telegraph
count-all-valid-pickup-and-delivery-options
Given n orders, each order consist in pickup and delivery services. Count all valid pickup/delivery possible sequences such that delivery(i) is always after of pickup(i). Since the answer may be too large, return it modulo 10^9 + 7. Example 1: Input:…
leetcode.com 2023-09-11
🟡1282.group-the-people-given-the-group-size-they-belong-to
🏷️ Tags
#array #hash_table
🟡1282.group-the-people-given-the-group-size-they-belong-to
🏷️ Tags
#array #hash_table
Telegraph
group-the-people-given-the-group-size-they-belong-to
There are n people that are split into some unknown number of groups. Each person is labeled with a unique ID from 0 to n - 1. You are given an integer array groupSizes, where groupSizes[i] is the size of the group that person i is in. For example, if groupSizes[1]…
leetcode.com 2023-09-12
🟡1647.minimum-deletions-to-make-character-frequencies-unique
🏷️ Tags
#greedy #hash_table #string #sorting
🟡1647.minimum-deletions-to-make-character-frequencies-unique
🏷️ Tags
#greedy #hash_table #string #sorting
Telegraph
minimum-deletions-to-make-character-frequencies-unique
A string s is called good if there are no two different characters in s that have the same frequency. Given a string s, return the minimum number of characters you need to delete to make s good. The frequency of a character in a string is the number of times…
leetcode.cn 2023-09-13
🟡2596.check-knight-tour-configuration
🏷️ Tags
#depth_first_search #breadth_first_search #array #matrix #simulation
🟡2596.check-knight-tour-configuration
🏷️ Tags
#depth_first_search #breadth_first_search #array #matrix #simulation
Telegraph
check-knight-tour-configuration
骑士在一张 n x n 的棋盘上巡视。在有效的巡视方案中,骑士会从棋盘的 左上角 出发,并且访问棋盘上的每个格子 恰好一次 。 给你一个 n x n 的整数矩阵 grid ,由范围 [0, n * n - 1] 内的不同整数组成,其中 grid[row][col] 表示单元格 (row, col) 是骑士访问的第 grid[row][col] 个单元格。骑士的行动是从下标 0 开始的。 如果 grid 表示了骑士的有效巡视方案,返回 true;否则返回 false。 注意,骑士行动时可以垂直移动两个格子…
leetcode.com 2023-09-14
🔴332.reconstruct-itinerary
🏷️ Tags
#depth_first_search #graph #eulerian_circuit
🔴332.reconstruct-itinerary
🏷️ Tags
#depth_first_search #graph #eulerian_circuit
Telegraph
reconstruct-itinerary
You are given a list of airline tickets where tickets[i] = [fromi, toi] represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it. All of the tickets belong to a man who departs from "JFK", thus, the…