leetcode.cn 2026-08-01
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
Telegraph
predict-the-winner
给你一个整数数组 nums 。玩家 1 和玩家 2 基于这个数组设计了一个游戏。 玩家 1 和玩家 2 轮流进行自己的回合,玩家 1 先手。开始时,两个玩家的初始分值都是 0 。每一回合,玩家从数组的任意一端取一个数字(即,nums[0] 或 nums[nums.length - 1]),取到的数字将会从数组中移除(数组长度减 1 )。玩家选中的数字将会加到他的得分上。当数组中没有剩余数字可取时,游戏结束。 如果玩家 1 能成为赢家,返回 true 。如果两个玩家得分相等,同样认为玩家 1 是游戏的赢家,也返回…
leetcode.com 2026-08-01
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
🟡486.predict-the-winner
🏷️ Tags
#recursion #array #math #dynamic_programming #game_theory
Telegraph
predict-the-winner
You are given an integer array nums. Two players are playing a game with this array: player 1 and player 2. Player 1 and player 2 take turns, with player 1 starting first. Both players start the game with a score of 0. At each turn, the player takes one of…
leetcode.com 2026-08-03
🔴1406.stone-game-iii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #zero_sum_game
🔴1406.stone-game-iii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #zero_sum_game
Telegraph
stone-game-iii
Alice and Bob continue their games with piles of stones. There are several stones arranged in a row, and each stone has an associated value which is an integer given in the array stoneValue. Alice and Bob take turns, with Alice starting first. On each player's…
leetcode.cn 2026-08-05
🟡3310.remove-methods-from-project
🏷️ Tags
#depth_first_search #breadth_first_search #graph
🟡3310.remove-methods-from-project
🏷️ Tags
#depth_first_search #breadth_first_search #graph
Telegraph
remove-methods-from-project
你正在维护一个项目,该项目有 n 个方法,编号从 0 到 n - 1。 给你两个整数 n 和 k,以及一个二维整数数组 invocations,其中 invocations[i] = [ai, bi] 表示方法 ai 调用了方法 bi。 已知如果方法 k 存在一个已知的 bug。那么方法 k 以及它直接或间接调用的任何方法都被视为 可疑方法 ,我们需要从项目中移除这些方法。 只有当一组方法没有被这组之外的任何方法调用时,这组方法才能被移除。 返回一个数组,包含移除所有 可疑方法 后剩下的所有方法。你可以…
leetcode.com 2026-08-05
🟡3310.remove-methods-from-project
🏷️ Tags
#depth_first_search #breadth_first_search #graph
🟡3310.remove-methods-from-project
🏷️ Tags
#depth_first_search #breadth_first_search #graph
Telegraph
remove-methods-from-project
You are maintaining a project that has n methods numbered from 0 to n - 1. You are given two integers n and k, and a 2D integer array invocations, where invocations[i] = [ai, bi] indicates that method ai invokes method bi. There is a known bug in method k.…
leetcode.cn 2026-08-07
🔴3348.smallest-divisible-digit-product-ii
🏷️ Tags
#greedy #math #string #backtracking #number_theory
🔴3348.smallest-divisible-digit-product-ii
🏷️ Tags
#greedy #math #string #backtracking #number_theory
Telegraph
smallest-divisible-digit-product-ii
给你一个字符串 num ,表示一个 正 整数,同时给你一个整数 t 。 如果一个整数 没有 任何数位是 0 ,那么我们称这个整数是 无零 数字。
leetcode.com 2026-08-07
🔴3348.smallest-divisible-digit-product-ii
🏷️ Tags
#greedy #math #string #backtracking #number_theory
🔴3348.smallest-divisible-digit-product-ii
🏷️ Tags
#greedy #math #string #backtracking #number_theory
Telegraph
smallest-divisible-digit-product-ii
You are given a string num which represents a positive integer, and an integer t. A number is called zero-free if none of its digits are 0. Return a string representing the smallest zero-free number greater than or equal to num such that the product of its…
leetcode.cn 2026-08-08
🟡3302.find-the-lexicographically-smallest-valid-sequence
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
🟡3302.find-the-lexicographically-smallest-valid-sequence
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
Telegraph
find-the-lexicographically-smallest-valid-sequence
给你两个字符串 word1 和 word2 。 如果一个字符串 x 修改 至多 一个字符会变成 y ,那么我们称它与 y 几乎相等 。 如果一个下标序列 seq 满足以下条件,我们称它是 合法的 :
leetcode.com 2026-08-08
🟡3302.find-the-lexicographically-smallest-valid-sequence
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
🟡3302.find-the-lexicographically-smallest-valid-sequence
🏷️ Tags
#greedy #two_pointers #string #dynamic_programming
Telegraph
find-the-lexicographically-smallest-valid-sequence
You are given two strings word1 and word2. A string x is called almost equal to y if you can change at most one character in x to make it identical to y. A sequence of indices seq is called valid if:
leetcode.cn 2026-08-09
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
Telegraph
stone-game-ii
Alice 和 Bob 继续他们的石子游戏。许多堆石子 排成一行,每堆都有正整数颗石子 piles[i]。游戏以谁手中的石子最多来决出胜负。 Alice 和 Bob 轮流进行,Alice 先开始。最初,M = 1。 在每个玩家的回合中,该玩家可以拿走剩下的 前 X 堆的所有石子,其中 1 <= X <= 2M。然后,令 M = max(M, X)。 游戏一直持续到所有石子都被拿走。 假设 Alice 和 Bob 都发挥出最佳水平,返回 Alice 可以得到的最大数量的石头。 示例 1: 输入:piles…
leetcode.com 2026-08-09
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
🟡1140.stone-game-ii
🏷️ Tags
#minimax_algorithm #array #math #dynamic_programming #game_theory #prefix_sum #zero_sum_game
Telegraph
stone-game-ii
Alice and Bob continue their games with piles of stones. There are a number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to end with the most stones. Alice and Bob take turns, with…
leetcode.cn 2026-08-10
🔴1510.stone-game-iv
🏷️ Tags
#minimax_algorithm #math #dynamic_programming #game_theory #nim_game #sprague_grundy_theorem #zero_sum_game
🔴1510.stone-game-iv
🏷️ Tags
#minimax_algorithm #math #dynamic_programming #game_theory #nim_game #sprague_grundy_theorem #zero_sum_game
Telegraph
stone-game-iv
Alice 和 Bob 两个人轮流玩一个游戏,Alice 先手。 一开始,有 n 个石子堆在一起。每个人轮流操作,正在操作的玩家可以从石子堆里拿走 任意 非零 平方数 个石子。 如果石子堆里没有石子了,则无法操作的玩家输掉游戏。 给你正整数 n ,且已知两个人都采取最优策略。如果 Alice 会赢得比赛,那么返回 True ,否则返回 False 。 示例 1: 输入:n = 1 输出:true 解释:Alice 拿走 1 个石子并赢得胜利,因为 Bob 无法进行任何操作。 示例 2: 输入:n =…
leetcode.com 2026-08-10
🔴1510.stone-game-iv
🏷️ Tags
#minimax_algorithm #math #dynamic_programming #game_theory #nim_game #sprague_grundy_theorem #zero_sum_game
🔴1510.stone-game-iv
🏷️ Tags
#minimax_algorithm #math #dynamic_programming #game_theory #nim_game #sprague_grundy_theorem #zero_sum_game
Telegraph
stone-game-iv
Alice and Bob take turns playing a game, with Alice starting first. Initially, there are n stones in a pile. On each player's turn, that player makes a move consisting of removing any non-zero square number of stones in the pile. Also, if a player cannot…