Leetcode Daily Question
@leetcodeDailyQuestionChannel
2.45K
subscribers
517
files
2.16K
links
Why are you asking me to do Leetcode for this CSS job?
Download Telegram
Join
Leetcode Daily Question
2.45K subscribers
Leetcode Daily Question
leetcode.cn
2025-05-30
🟡
2359.find-closest-node-to-given-two-nodes
🏷️
Tags
#depth_first_search
#graph
Telegraph
find-closest-node-to-given-two-nodes
给你一个 n 个节点的 有向图 ,节点编号为 0 到 n - 1 ,每个节点 至多 有一条出边。 有向图用大小为 n 下标从 0 开始的数组 edges 表示,表示节点 i 有一条有向边指向 edges[i] 。如果节点 i 没有出边,那么 edges[i] == -1 。 同时给你两个节点 node1 和 node2 。 请你返回一个从 node1 和 node2 都能到达节点的编号,使节点 node1 和节点 node2 到这个节点的距离 较大值最小化。如果有多个答案,请返回 最小 的节点编号。如果答案不存在,返回…
来源
答案
Leetcode Daily Question
leetcode.com
2025-05-30
🟡
2359.find-closest-node-to-given-two-nodes
🏷️
Tags
#depth_first_search
#graph
Telegraph
find-closest-node-to-given-two-nodes
You are given a directed graph of n nodes numbered from 0 to n - 1, where each node has at most one outgoing edge. The graph is represented with a given 0-indexed array edges of size n, indicating that there is a directed edge from node i to node edges[i].…
Source
Solution
Leetcode Daily Question
leetcode.cn
2025-06-08
🟡
386.lexicographical-numbers
🏷️
Tags
#depth_first_search
#trie
Telegraph
lexicographical-numbers
给你一个整数 n ,按字典序返回范围 [1, n] 内所有整数。 你必须设计一个时间复杂度为 O(n) 且使用 O(1) 额外空间的算法。 示例 1: 输入:n = 13 输出:[1,10,11,12,13,2,3,4,5,6,7,8,9] 示例 2: 输入:n = 2 输出:[1,2] 提示:
来源
答案
Leetcode Daily Question
leetcode.com
2025-06-08
🟡
386.lexicographical-numbers
🏷️
Tags
#depth_first_search
#trie
Telegraph
lexicographical-numbers
Given an integer n, return all the numbers in the range [1, n] sorted in lexicographical order. You must write an algorithm that runs in O(n) time and uses O(1) extra space. Example 1: Input: n = 13 Output: [1,10,11,12,13,2,3,4,5,6,7,8,9] Example 2: Input:…
Source
Solution