随笔分类 -  LeetCode

摘要:打地鼠 欢迎各位勇者来到力扣城,本次试炼主题为「打地鼠」。 勇者面前有一个大小为 3*3 的打地鼠游戏机,地鼠将随机出现在各个位置,moles[i] = [t,x,y] 表示在第 t 秒会有地鼠出现在 (x,y) 位置上,并于第 t+1 秒该地鼠消失。 勇者有一把可敲打地鼠的锤子,初始时刻(即第 0 阅读全文
posted @ 2022-12-16 17:45 onlyblues 阅读(125) 评论(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 阅读(73) 评论(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 阅读(22) 评论(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 阅读(30) 评论(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 阅读(47) 评论(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 阅读(64) 评论(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 阅读(38) 评论(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 阅读(109) 评论(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 阅读(60) 评论(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 阅读(47) 评论(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 阅读(43) 评论(0) 推荐(0) 编辑
摘要:单调栈的定义与证明 前言 最近领悟到了单调栈的本质,特此来记录一下我的理解。 单调栈主要用来解决这样一类问题,当枚举到下标i,要求在下标i之前小于/大于val的数的下标中,找到最小/最大的下标位置。 一共有四种不同的情况,下面来证明在这四种情况中,栈内维护的元素始终单调递增或单调 阅读全文
posted @ 2022-09-28 18:55 onlyblues 阅读(862) 评论(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 阅读(20) 评论(0) 推荐(0) 编辑
摘要:Longest Subarray With Maximum Bitwise AND You are given an integer array nums of size n. Consider a non-empty subarray from nums that has the maximu 阅读全文
posted @ 2022-09-25 16:07 onlyblues 阅读(45) 评论(0) 推荐(0) 编辑
摘要:Sum of Prefix Scores of Strings You are given an array words of sizeco n sisting of non-empty strings. We define the score of a string word as the n 阅读全文
posted @ 2022-09-19 20:43 onlyblues 阅读(64) 评论(0) 推荐(0) 编辑
摘要:Minimum Money Required Before Transactions You are given a 0-indexed 2D integer array transactions , where transactions[i] = [costi, cashbacki] . The 阅读全文
posted @ 2022-09-19 19:44 onlyblues 阅读(32) 评论(0) 推荐(0) 编辑
摘要:Smallest Subarrays With Maximum Bitwise OR You are given a 0-indexed array nums of length n, consisting of non-negative integers. For each index i 阅读全文
posted @ 2022-09-18 19:36 onlyblues 阅读(56) 评论(0) 推荐(0) 编辑
摘要:最长上升子序列 给定一个长度为 N 的数列,求数值严格单调递增的子序列的长度最长是多少。 输入格式 第一行包含整数 N。 第二行包含 N 个整数,表示完整序列。 输出格式 输出一个整数,表示最大长度。 数据范围 1N1000,${−10}^{9} \leq \ 阅读全文
posted @ 2022-09-13 16:24 onlyblues 阅读(888) 评论(0) 推荐(0) 编辑
摘要:Evaluate Division You are given an array of variable pairs equations and an array of real numbers values , where equations[i] = [Ai, Bi] and values[i] 阅读全文
posted @ 2022-09-07 21:23 onlyblues 阅读(22) 评论(0) 推荐(0) 编辑
摘要:Count Unique Characters of All Substrings of a Given String Let's define a function countUniqueChars(s) that returns the number of unique characters o 阅读全文
posted @ 2022-09-06 16:16 onlyblues 阅读(36) 评论(0) 推荐(0) 编辑

Web Analytics
点击右上角即可分享
微信分享提示