[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-09 #leetcode #array #hashmap #java #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 #hashmap #java #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-26 #leetcode #array #java #prefix sum #bit manipulation
[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 #array #hashmap #java #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 #hashmap #java #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 #array #java #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 #array #hashmap #java #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 #array #java #sliding window #string