CNoodle
  • Home
  • Archives
  • Tags
  • About

[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 #array #java #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 #hashmap #java #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 #array #java #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 #array #java #prefix sum #math

[LeetCode] 3152. Special Array II

An array is considered special if every pair of its adjacent elements contains two numbers with different parity. You are given an array of integer nums and a 2D integer matrix queries, where for quer
2024-12-09
#leetcode #array #java #prefix sum

[LeetCode] 2684. Maximum Number of Moves in a Grid

You are given a 0-indexed m x n matrix grid consisting of positive integers. You can start at any cell in the first column of the matrix, and traverse the grid in the following way: From a cell (row,
2024-12-07
#leetcode #array #java #bfs #dfs #dynamic programming #matrix

[LeetCode] 2825. Make String a Subsequence Using Cyclic Increments

You are given two 0-indexed strings str1 and str2. In an operation, you select a set of indices in str1, and for each index i in the set, increment str1[i] to the next character cyclically. That is ‘a
2024-12-04
#leetcode #two pointer #java #string

[LeetCode] 3206. Alternating Groups I

There is a circle of red and blue tiles. You are given an array of integers colors. The color of tile i is represented by colors[i]:colors[i] == 0 means that tile i is red.colors[i] =&#
2024-11-25
#leetcode #array #java #sliding window

[LeetCode] 1861. Rotating the Box

You are given an m x n matrix of characters box representing a side-view of a box. Each cell of the box is one of the following:A stone ‘#’A stationary obstacle ‘*’Empty ‘.’ The box is rotated 90 degr
2024-11-24
#leetcode #array #two pointer #java #matrix
123456…43

Search

Hexo Fluid