Avatar

Organizations

17 results for 动态规划
  • 给定一个字符串  (s) 和一个字符模式  (p),实现一个支持  '?'  和  '*'  的通配符匹配。

    leetcode 困难 贪心 递归 字符串 Created Tue, 06 Dec 2022 14:03:07 +0800
  • 给定一个  m x n 整数矩阵  matrix ,找出其中 最长递增路径 的长度。

    对于每个单元格,你可以往上,下,左,右四个方向移动。 你 不能对角线 方向上移动或移动到 边界外(即不允许环绕)。

  • The demons had captured the princess and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of m x n rooms laid out in a 2D grid. Our valiant knight was initially positioned in the top-left room and must fight his way through dungeon to rescue the princess.

    The knight has an initial health point represented by a positive integer. If at any point his health point drops to 0 or below, he dies immediately.

    Some of the rooms are guarded by demons (represented by negative integers), so the knight loses health upon entering these rooms; other rooms are either empty (represented as 0) or contain magic orbs that increase the knight’s health (represented by positive integers).

    To reach the princess as quickly as possible, the knight decides to move only rightward or downward in each step.

    Return the knight’s minimum initial health so that he can rescue the princess.

    leetcode 困难 数组 动态规划 矩阵 Created Tue, 13 Sep 2022 17:00:13 +0800
  • 给你一个 只包含正整数非空 数组  nums。请你判断是否可以将这个数组分割成两个子集,使得两个子集的元素和相等。

    leetcode 中等 数组 动态规划 Created Tue, 13 Sep 2022 15:17:46 +0800
  • 给你一个整数数组 nums 。玩家 1 和玩家 2 基于这个数组设计了一个游戏。

    玩家 1 和玩家 2 轮流进行自己的回合,玩家 1 先手。开始时,两个玩家的初始分值都是 0。每一回合,玩家从数组的任意一端取一个数字(即,nums[0]nums[nums.length - 1]),取到的数字将会从数组中移除(数组长度减 1)。玩家选中的数字将会加到他的得分上。当数组中没有剩余数字可取时,游戏结束。

    如果玩家 1 能成为赢家,返回 true 。如果两个玩家得分相等,同样认为玩家 1 是游戏的赢家,也返回 true。你可以假设每个玩家的玩法都会使他的分数最大化。

    leetcode 中等 递归 数组 数学 Created Tue, 13 Sep 2022 13:43:09 +0800
  • 给定一个仅包含  01 、大小为 rows x cols 的二维二进制矩阵,找出只包含 1 的最大矩形,并返回其面积。

    leetcode 困难 数组 动态规划 Created Tue, 13 Sep 2022 12:53:39 +0800
  • 给定一个整数数组prices,其中第  prices[i]  表示第  i  天的股票价格。​

    设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票):

    • 卖出股票后,你无法在第二天买入股票 (即冷冻期为 1 天)。
    leetcode 中等 数组 动态规划 Created Thu, 08 Sep 2022 14:15:02 +0800
  • Given an array of intervals intervals where \(intervals[i] = [start_i, end_i]\), return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.

    leetcode 单推人 贪心 数组 动态规划 Created Sun, 26 Jun 2022 13:49:43 +0800
  • Given a string s, return the longest palindromic substring in s.

    leetcode 中等 字符串 动态规划 Created Wed, 08 Jun 2022 13:14:02 +0800
  • You are given a 0-indexed binary string floor, which represents the colors of tiles on a floor:

    • floor[i] = '0' denotes that the ith tile of the floor is colored black.
    • On the other hand, floor[i] = '1' denotes that the ith tile of the floor is colored white.

    You are also given numCarpets and carpetLen. You have numCarpets black carpets, each of length carpetLen tiles. Cover the tiles with the given carpets such that the number of white tiles still visible is minimum. Carpets may overlap one another.

    Return the minimum number of white tiles still visible.

    leetcode 困难 动态规划 Created Sun, 20 Mar 2022 17:49:37 +0800
Next