首页 > TAG信息列表 > currentMax

1446. Consecutive Characters

/** 1446. Consecutive Characters https://leetcode.com/problems/consecutive-characters/ The power of the string is the maximum length of a non-empty substring that contains only one unique character. Given a string s, return the power of s. Example 1: Inp

剑指 Offer 42. 连续子数组的最大和

    这道题只有一个难点,那就是怎么定义dp[i] 我首先想dpi代表前i项的连续最大和,但这条路走不通,递推方程写不出来 其次想的是dpi代表结果数组大小为i的情况,但也走不通。 一看答案才发现,应该定义dpi为以numsi为结尾的数组 这样确实也是穷举了所有情况,而且非常好写递推 但是确实没

1725. Number Of Rectangles That Can Form The Largest Square

package LeetCode_1725 /** * 1725. Number Of Rectangles That Can Form The Largest Square * https://leetcode.com/problems/number-of-rectangles-that-can-form-the-largest-square/ * You are given an array rectangles where rectangles[i] = [li, wi] represent

Leetcode 515 每个树行中的最大值 BFS

    采用 BFS 算法逐行遍历,JAVA 解法: public final List<Integer> largestValues(TreeNode root) { List<Integer> reList = new LinkedList<Integer>(); if (root == null) return reList; Queue<TreeNode> queue = new Linked