All Posts

Leetcode 2680: Maximum OR

You are given a 0-indexed integer array nums of length n and an integer k. In each operation, you can pick an element from the array and multiply it by 2. Your goal is to determine the maximum possible value of the bitwise OR of all elements in the array after applying the operation at most k times.

Leetcode 2731: Movement of Robots

A number of robots are standing on an infinite number line with their initial positions given in the array nums. Each robot will move based on a command string s where ‘L’ means left and ‘R’ means right. If two robots collide, they instantly reverse their directions. Your task is to calculate the sum of the distances between all pairs of robots d seconds after the command.

Leetcode 2772: Apply Operations to Make All Array Elements Equal to Zero

You are given a 0-indexed integer array nums and a positive integer k. You can repeatedly select a contiguous subarray of size k and decrease all its elements by 1. Determine if it is possible to make all elements in nums equal to 0 using this operation.

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