随笔分类 - LeetCode
摘要:Minimum Edge Weight Equilibrium Queries in a Tree There is an undirected tree with n nodes labeled from 0 to n - 1. You are given the integer n and a
阅读全文
摘要:Number of Beautiful Integers in the Range You are given positive integers low, high, and k. A number is beautiful if it meets both of the following co
阅读全文
摘要:Count of Integers You are given two numeric strings num1 and num2 and two integers max_sum and min_sum. We denote an integer x to be good if: num1 <=
阅读全文
摘要:Maximum Strictly Increasing Cells in a Matrix Given a 1-indexed m x n integer matrix mat, you can select any cell in the matrix as your starting cell.
阅读全文
摘要:Minimum Number of Visited Cells in a Grid You are given a 0-indexed m x n integer matrix grid . Your initial position is at the top-left cell (0, 0).
阅读全文
摘要:Minimum Reverse Operations You are given an integer n and an integer p in the range [0, n - 1]. Representing a 0-indexed array arr of length n where a
阅读全文
摘要:Shortest Cycle in a Graph There is a bi-directional graph with n vertices, where each vertex is labeled from 0 to n - 1. The edges in the graph are re
阅读全文
摘要:The Number of Good Subsets You are given an integer array nums . We call a subset of nums good if its product can be represented as a product of one o
阅读全文
摘要:Count the Number of Square-Free Subsets You are given a positive integer 0-indexed array nums . A subset of the array nums is square-free if the produ
阅读全文
摘要:Handling Sum Queries After Update You are given two 0-indexed arrays nums1 and nums2 and a 2D array queries of queries. There are three types of queri
阅读全文
摘要:Subsequence With the Minimum Score You are given two strings $s$ and $t$ . You are allowed to remove any number of characters from the string t. The s
阅读全文
摘要:Substring XOR Queries You are given a binary string s , and a 2D integer array queries where queries[i] = [firsti, secondi] . For the ith query, find
阅读全文
摘要:Count the Number of Fair Pairs Given a 0-indexed integer array nums of size n and two integers lower and upper , return the number of fair pairs. A pa
阅读全文
摘要:Disconnect Path in a Binary Matrix by at Most One Flip You are given a 0-indexed $m \times n$ binary matrix grid . You can move from a cell (row, col)
阅读全文
摘要:Maximize Win From Two Segments There are some prizes on the X-axis. You are given an integer array prizePositions that is sorted in non-decreasing ord
阅读全文
摘要:Minimum Cost to Make Array Equal You are given two 0-indexed arrays nums and cost consisting each of $n$ positive integers. You can do the following o
阅读全文
摘要:Count Increasing Quadruplets Given a 0-indexed integer array nums of size $n$ containing all numbers from $1$ to $n$, return the number of increasing
阅读全文
摘要:Put Marbles in Bags You have k bags. You are given a 0-indexed integer array weights where weights[i] is the weight of the ith marble. You are also gi
阅读全文
摘要:Rank Transform of a Matrix Given an m x n matrix , return a new matrix answer where answer[row][col] is the rank of matrix[row][col] . The rank is an
阅读全文
摘要:Minimum Cost to Split an Array You are given an integer array nums and an integer $k$. Split the array into some number of non-empty subarrays. The co
阅读全文

浙公网安备 33010602011771号