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 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 2859: Sum of Values at Indices With K Set Bits

Given a list of integers and an integer k, return the sum of all elements whose indices have exactly k set bits in their binary representation.

Leetcode 2864: Maximum Odd Binary Number

You are given a binary string s containing at least one ‘1’. Your task is to rearrange the bits in such a way that the resulting binary number is the largest possible odd binary number that can be formed from the given bits. A binary number is odd if its least significant bit (last bit) is ‘1’. The resulting binary number may contain leading zeros.

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 2873: Maximum Value of an Ordered Triplet I

You are given an array nums of integers. Find the maximum value over all possible triplets of indices (i, j, k) such that i < j < k. The value of a triplet (i, j, k) is calculated as (nums[i] - nums[j]) * nums[k]. If all triplets have negative values, return 0.