CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2226. Maximum Candies Allocated to K Children

You are given a 0-indexed integer array candies. Each element in the array denotes a pile of candies of size candies[i]. You can divide each pile into any number of sub piles, but you cannot merge two
2025-03-13
#leetcode #java #array #binary search #binary search on answer

[LeetCode] 3101. Count Alternating Subarrays

You are given a binary array nums. We call a subarray alternating if no two adjacent elements in the subarray have the same value. Return the number of alternating subarrays in nums. Example 1:Input:
2025-03-10
#leetcode #java #array #math

[LeetCode] 3208. Alternating Groups II

There is a circle of red and blue tiles. You are given an array of integers colors and an integer k. The color of tile i is represented by colors[i]:colors[i] == 0 means that tile i is red.c
2025-03-09
#leetcode #java #array #sliding window

[LeetCode] 2269. Find the K-Beauty of a Number

The k-beauty of an integer num is defined as the number of substrings of num when it is read as a string that meet the following conditions: It has a length of k.It is a divisor of num.Given integers
2025-03-09
#leetcode #java #sliding window #sliding window with fixed size #math #string

[LeetCode] 2588. Count the Number of Beautiful Subarrays

You are given a 0-indexed integer array nums. In one operation, you can:Choose two different indices i and j such that 0 <= i, j < nums.length.Choose a non-negative integer k such that the
2025-03-05
#leetcode #java #hashmap #prefix sum #bit manipulation

[LeetCode] 2506. Count Pairs Of Similar Strings

You are given a 0-indexed string array words. Two strings are similar if they consist of the same characters. For example, “abca” and “cba” are similar since both consist of characters ‘a’, ‘b’, and ‘
2025-02-21
#leetcode #java #array #hashmap #two sum #counting sort #string

[LeetCode] 2658. Maximum Number of Fish in a Grid

You are given a 0-indexed 2D matrix grid of size m x n, where (r, c) represents:A land cell if grid[r][c] = 0, orA water cell containing grid[r][c] fish, if grid[r][c] > 0.A fisher can start a
2025-02-16
#leetcode #bfs #dfs #java #flood fill

[LeetCode] 2342. Max Sum of a Pair With Equal Sum of Digits

You are given a 0-indexed array nums consisting of positive integers. You can choose two indices i and j, such that i != j, and the sum of digits of the number nums[i] is equal to that of nums[j]
2025-02-11
#leetcode #java #array #hashmap #two sum

[LeetCode] 2364. Count Number of Bad Pairs

You are given a 0-indexed integer array nums. A pair of indices (i, j) is a bad pair if i < j and j - i != nums[j] - nums[i]. Return the total number of bad pairs in nums. Example 1:Input: num
2025-02-08
#leetcode #java #array #hashmap #two sum

[LeetCode] 2349. Design a Number Container System

Design a number container system that can do the following:Insert or Replace a number at the given index in the system.Return the smallest index for the given number in the system. Implement the Numbe
2025-02-08
#leetcode #java #hashmap #treemap #design
1234…41

Search

Hexo Fluid