All Posts

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 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.

Leetcode 2869: Minimum Operations to Collect Elements

You are given an array nums containing positive integers and an integer k. In each operation, you can remove the last element from the array and add it to your collection. Your task is to determine the minimum number of operations needed to collect all elements from 1 to k (inclusive).

Leetcode 2870: Minimum Number of Operations to Make Array Empty

You are given an array nums consisting of positive integers. You are allowed to perform two types of operations on the array any number of times: (1) Choose two elements that are the same and remove them from the array. (2) Choose three elements that are the same and remove them from the array. Your task is to return the minimum number of operations required to empty the array, or return -1 if it is not possible to empty the array using these operations.

Leetcode 2875: Minimum Size Subarray in Infinite Array

You are given an array nums and an integer target. The array infinite_nums is created by infinitely appending nums to itself. You need to find the length of the shortest contiguous subarray in infinite_nums whose sum equals the target. If no such subarray exists, return -1.