All Posts

Leetcode 2735: Collecting Chocolates

You are given an array nums where each element represents the cost of collecting a chocolate of a specific type. You can perform an operation to change the types of chocolates, and each operation incurs a cost. Your task is to determine the minimum total cost to collect all types of chocolates.

Leetcode 2740: Find the Value of the Partition

You are given a list of positive integers nums. Your task is to partition this list into two non-empty arrays, nums1 and nums2, such that the absolute difference between the maximum element of nums1 and the minimum element of nums2 is minimized.

Leetcode 2741: Special Permutations

You are given a list of distinct positive integers nums. A permutation of nums is considered special if, for every pair of consecutive numbers in the permutation, one number is divisible by the other. Your task is to return the total number of special permutations of nums, modulo 10^9 + 7.

Leetcode 2746: Decremental String Concatenation

You are given an array of distinct strings. Your task is to perform n-1 join operations optimally to minimize the length of the final string.

Leetcode 2747: Count Zero Request Servers

Given a list of server requests and multiple queries specifying time intervals, determine the number of servers that did not receive any requests during each query’s time interval.

Leetcode 2750: Ways to Split Array Into Good Subarrays

You are given a binary array ’nums’ containing only 0s and 1s. A good subarray is defined as a contiguous subarray that contains exactly one 1. Your task is to find the number of ways to split the array into good subarrays. Return the result modulo (10^9 + 7).