All Posts

Leetcode 2845: Count of Interesting Subarrays

You are given an array of integers ’nums’, a positive integer ‘modulo’, and a non-negative integer ‘k’. Your task is to count the number of subarrays in ’nums’ that are interesting. A subarray ’nums[l..r]’ is interesting if the count of elements ’nums[i]’ such that ’nums[i] % modulo == k’ satisfies the condition ‘cnt % modulo == k’. Return the total count of such interesting subarrays.

Leetcode 2848: Points That Intersect With Cars

You are given a list of cars represented by their starting and ending positions on a number line. Your task is to count how many distinct integer points are covered by any part of a car.

Leetcode 2850: Minimum Moves to Spread Stones Over Grid

You are given a 3x3 grid representing stones placed in each cell. In one move, you can move a stone from its current cell to an adjacent cell. The goal is to place one stone in each cell, minimizing the number of moves.

Leetcode 2855: Minimum Right Shifts to Sort the Array

You are given a list of distinct positive integers. Your task is to determine the minimum number of right shifts needed to sort the list in ascending order, or return -1 if it is not possible.

Leetcode 2856: Minimum Array Length After Pair Removals

You are given a non-decreasing sorted integer array. Perform operations to remove pairs of elements where nums[i] < nums[j] and return the minimum length of the array after the operations.

Leetcode 2857: Count Pairs of Points With Distance k

Given a list of 2D points and an integer k, find the number of pairs of points whose distance (calculated as XOR sum of their coordinates) equals k.