CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2909. Minimum Sum of Mountain Triplets II

You are given a 0-indexed array nums of integers. A triplet of indices (i, j, k) is a mountain if:i < j < knums[i] < nums[j] and nums[k] < nums[j]Return the minimum possible sum of a mount
2025-01-17
#leetcode #java #array #hashmap #two sum

[LeetCode] 3258. Count Substrings That Satisfy K-Constraint I

You are given a binary string s and an integer k. A binary string satisfies the k-constraint if either of the following conditions holds:The number of 0’s in the string is at most k.The number of 1’s
2025-01-08
#leetcode #java #sliding window #string

[LeetCode] 3325. Count Substrings With K-Frequency Characters I

Given a string s and an integer k, return the total number of substrings of s where at least one character appears at least k times. Example 1:Input: s = “abacb”, k = 2Output: 4 Explanation:
2025-01-03
#leetcode #java #hashmap #sliding window #string

[LeetCode] 2779. Maximum Beauty of an Array After Applying Operation

You are given a 0-indexed array nums and a non-negative integer k. In one operation, you can do the following:Choose an index i that hasn’t been chosen before from the range [0, nums.length - 1].Repla
2024-12-18
#leetcode #java #array #sliding window

[LeetCode] 2958. Length of Longest Subarray With at Most K Frequency

You are given an integer array nums and an integer k. The frequency of an element x is the number of times it occurs in an array. An array is called good if the frequency of each element in this array
2024-12-16
#leetcode #java #array #hashmap #sliding window

[LeetCode] 2730. Find the Longest Semi-Repetitive Substring

You are given a digit string s that consists of digits from 0 to 9. A string is called semi-repetitive if there is at most one adjacent pair of the same digit. For example, “0010”, “002020”, “0123”, “
2024-12-15
#leetcode #java #array #sliding window #string

[LeetCode] 2593. Find Score of an Array After Marking All Elements

You are given an array nums consisting of positive integers. Starting with score = 0, apply the following algorithm: Choose the smallest integer of the array that is not marked. If there is a tie
2024-12-13
#leetcode #java #sort #simulation

[LeetCode] 1297. Maximum Number of Occurrences of a Substring

Given a string s, return the maximum number of occurrences of any substring under the following rules:The number of unique characters in the substring must be less than or equal to maxLetters.The subs
2024-12-12
#leetcode #java #hashmap #sliding window #sliding window with fixed size #string

[LeetCode] 3111. Minimum Rectangles to Cover Points

You are given a 2D integer array points, where points[i] = [xi, yi]. You are also given an integer w. Your task is to cover all the given points with rectangles. Each rectangle has its lower end
2024-12-10
#leetcode #java #array #greedy #sort

[LeetCode] 1524. Number of Sub-arrays With Odd Sum

Given an array of integers arr, return the number of subarrays with an odd sum. Since the answer can be very large, return it modulo 109 + 7. Example 1:Input: arr = [1,3,5]Output: 4Explanation: A
2024-12-09
#leetcode #java #array #prefix sum #math
123456…44

Search

Hexo Fluid