[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 #counting sort #two sum #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
[LeetCode] 2683. Neighboring Bitwise XOR A 0-indexed array derived with length n is derived by computing the bitwise XOR (⊕) of adjacent values in a binary array original of length n. Specifically, for each index i in the range [0, n - 1]:If 2025-01-26 #leetcode #java #prefix sum #bit manipulation
[LeetCode] 1310. XOR Queries of a Subarray You are given an array arr of positive integers. You are also given the array queries where queries[i] = [left, right]. For each query i compute the XOR of elements from left to right (that is, a 2025-01-25 #leetcode #java #array #prefix sum #bit manipulation