Leetcode Daily Question
@leetcodeDailyQuestionChannel
2.46K
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.46K subscribers
Leetcode Daily Question
leetcode.cn
2025-05-02
🟡
838.push-dominoes
🏷️
Tags
#two_pointers
#string
#dynamic_programming
Telegraph
push-dominoes
n 张多米诺骨牌排成一行,将每张多米诺骨牌垂直竖立。在开始时,同时把一些多米诺骨牌向左或向右推。 每过一秒,倒向左边的多米诺骨牌会推动其左侧相邻的多米诺骨牌。同样地,倒向右边的多米诺骨牌也会推动竖立在其右侧的相邻多米诺骨牌。 如果一张垂直竖立的多米诺骨牌的两侧同时有多米诺骨牌倒下时,由于受力平衡, 该骨牌仍然保持不变。 就这个问题而言,我们会认为一张正在倒下的多米诺骨牌不会对其它正在倒下或已经倒下的多米诺骨牌施加额外的力。 给你一个字符串 dominoes 表示这一行多米诺骨牌的初始状态,其中:
来源
答案
Leetcode Daily Question
leetcode.com
2025-05-02
🟡
838.push-dominoes
🏷️
Tags
#two_pointers
#string
#dynamic_programming
Telegraph
push-dominoes
There are n dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right. After each second, each domino that is falling to the left pushes the adjacent domino…
Source
Solution
Leetcode Daily Question
leetcode.cn
2025-05-17
🟡
75.sort-colors
🏷️
Tags
#array
#two_pointers
#sorting
Telegraph
sort-colors
给定一个包含红色、白色和蓝色、共 n 个元素的数组 nums ,原地 对它们进行排序,使得相同颜色的元素相邻,并按照红色、白色、蓝色顺序排列。 我们使用整数 0、 1 和 2 分别表示红色、白色和蓝色。 必须在不使用库内置的 sort 函数的情况下解决这个问题。 示例 1: 输入:nums = [2,0,2,1,1,0] 输出:[0,0,1,1,2,2] 示例 2: 输入:nums = [2,0,1] 输出:[0,1,2] 提示:
来源
答案