随笔分类 -  LeetCode

摘要:Difference Between Maximum and Minimum Price Sum There exists an undirected and initially unrooted tree with $n$ nodes indexed from $0$ to $n - 1$. Yo 阅读全文
posted @ 2023-01-18 12:15 onlyblues 阅读(86) 评论(0) 推荐(0)
摘要:Maximize the Minimum Powered City You are given a 0-indexed integer array stations of length $n$, where stations[i] represents the number of power sta 阅读全文
posted @ 2023-01-13 16:05 onlyblues 阅读(43) 评论(0) 推荐(0)
摘要:Number of Great Partitions You are given an array nums consisting of positive integers and an integer k . Partition the array into two ordered groups  阅读全文
posted @ 2023-01-12 23:18 onlyblues 阅读(66) 评论(0) 推荐(0)
摘要:Count Pairs With XOR in a Range Given a (0-indexed) integer array nums and two integers low and high , return the number of nice pairs. A nice pair is 阅读全文
posted @ 2023-01-12 16:45 onlyblues 阅读(62) 评论(0) 推荐(0)
摘要:Maximum Number of Points From Grid Queries You are given an $m \times n$ integer matrix grid and an array queries of size $k$. Find an array answer of 阅读全文
posted @ 2023-01-11 17:24 onlyblues 阅读(172) 评论(0) 推荐(0)
摘要:Frog Jump II You are given a 0-indexed integer array stones sorted in strictly increasing order representing the positions of stones in a river. A fro 阅读全文
posted @ 2023-01-11 10:15 onlyblues 阅读(84) 评论(0) 推荐(0)
摘要:Add Edges to Make Degrees of All Nodes Even There is an undirected graph consisting of $n$ nodes numbered from $1$ to $n$. You are given the integer $ 阅读全文
posted @ 2022-12-18 17:31 onlyblues 阅读(52) 评论(0) 推荐(0)
摘要:打地鼠 欢迎各位勇者来到力扣城,本次试炼主题为「打地鼠」。 勇者面前有一个大小为 3*3 的打地鼠游戏机,地鼠将随机出现在各个位置,moles[i] = [t,x,y] 表示在第 t 秒会有地鼠出现在 (x,y) 位置上,并于第 t+1 秒该地鼠消失。 勇者有一把可敲打地鼠的锤子,初始时刻(即第 0 阅读全文
posted @ 2022-12-16 17:45 onlyblues 阅读(159) 评论(0) 推荐(0)
摘要:Count Subarrays With Median K You are given an array nums of size $n$ consisting of distinct integers from $1$ to $n$ and a positive integer $k$. Retu 阅读全文
posted @ 2022-11-27 14:04 onlyblues 阅读(80) 评论(0) 推荐(0)
摘要:Number of Beautiful Partitions You are given a string s that consists of the digits '1' to '9' and two integers k and minLength. A partition of s is c 阅读全文
posted @ 2022-11-20 15:38 onlyblues 阅读(41) 评论(0) 推荐(0)
摘要:Maximum Number of Non-overlapping Palindrome Substrings You are given a string s and a positive integer k . Select a set of non-overlapping substrings 阅读全文
posted @ 2022-11-14 20:38 onlyblues 阅读(103) 评论(0) 推荐(0)
摘要:Minimum Number of Operations to Sort a Binary Tree by Level You are given the root of a binary tree with unique values. In one operation, you can choo 阅读全文
posted @ 2022-11-14 20:10 onlyblues 阅读(77) 评论(0) 推荐(0)
摘要:Next Greater Element IV You are given a 0-indexed array of non-negative integers nums . For each integer in nums , you must find its respective second 阅读全文
posted @ 2022-10-30 23:20 onlyblues 阅读(77) 评论(0) 推荐(0)
摘要:Count Subarrays With Fixed Bounds You are given an integer array nums and two integers minK and maxK . A fixed-bound subarray of nums is a subarray th 阅读全文
posted @ 2022-10-16 16:58 onlyblues 阅读(55) 评论(0) 推荐(0)
摘要:Minimize Maximum of Array You are given a 0-indexed array nums comprising of $n$ non-negative integers. In one operation, you must: Choose an integer 阅读全文
posted @ 2022-10-16 15:13 onlyblues 阅读(144) 评论(0) 推荐(0)
摘要:Minimum Swaps To Make Sequences Increasing You are given two integer arrays of the same length nums1 and nums2 . In one operation, you are allowed to 阅读全文
posted @ 2022-10-10 21:08 onlyblues 阅读(107) 评论(0) 推荐(0)
摘要:Using a Robot to Print the Lexicographically Smallest String You are given a string s and a robot that currently holds an empty string t . Apply one o 阅读全文
posted @ 2022-10-09 23:28 onlyblues 阅读(60) 评论(0) 推荐(0)
摘要:Maximum Deletions on a String You are given a string s consisting of only lowercase English letters. In one operation, you can: Delete the entire stri 阅读全文
posted @ 2022-10-06 17:04 onlyblues 阅读(57) 评论(0) 推荐(0)
摘要:单调栈的定义与证明 前言 最近领悟到了单调栈的本质,特此来记录一下我的理解。 单调栈主要用来解决这样一类问题,当枚举到下标$i$,要求在下标$i$之前小于$/$大于$val$的数的下标中,找到最小$/$最大的下标位置。 一共有四种不同的情况,下面来证明在这四种情况中,栈内维护的元素始终单调递增或单调 阅读全文
posted @ 2022-09-28 18:55 onlyblues 阅读(1039) 评论(0) 推荐(0)
摘要:Find All Good Indices You are given a 0-indexed integer array nums of size $n$ and a positive integer $k$. We call an index $i$ in the range $k \leq i 阅读全文
posted @ 2022-09-25 16:33 onlyblues 阅读(32) 评论(0) 推荐(0)

Web Analytics