[Codeforces] Round 733 (Div. 1 + Div. 2, based on VK Cup 2021 - Elimination (Engine)) E. MinimaxRead more
[Codeforces] Round 725 (Div. 3) E. Funny SubstringsRead more
[Codeforces] Round 725 (Div. 3) G. Gift SetRead more
[Codeforces] Round 731 (Div. 3) G. How Many Paths?Read more
[LeetCode] Divide an Array Into Subarrays With Minimum Cost II

3013. Divide an Array Into Subarrays With Minimum Cost II

You are given a 0-indexed array of integers nums of length n, and two positive integers k and dist.

The cost of an array is the value of its first element. For example, the cost of [1,2,3] is 1 while the cost of [3,4,1] is 3.

You need to divide nums into k disjoint contiguous subarrays, such that the difference between the starting index of the second subarray and the starting index of the kth subarray should be less than or equal to dist. In other words, if you divide nums into the subarrays nums[0..(i1 - 1)], nums[i1..(i2 - 1)], ..., nums[ik-1..(n - 1)], then ik-1 - i1 <= dist.

Return the minimum possible sum of the cost of these subarrays.

Read more
[LeetCode] Minimize Length of Array Using Operations

3012. Minimize Length of Array Using Operations

You are given a 0-indexed integer array nums containing positive integers.

Your task is to minimize the length of nums by performing the following operations any number of times (including zero):

  • Select two distinct indices i and j from nums, such that nums[i] > 0 and nums[j] > 0.
  • Insert the result of nums[i] % nums[j] at the end of nums.
  • Delete the elements at indices i and j from nums.

Return an integer denoting the minimum length of nums after performing the operation any number of times.

Read more
[LeetCode] Find if Array Can Be Sorted

3011. Find if Array Can Be Sorted

You are given a 0-indexed array of positive integers nums.

In one operation, you can swap any two adjacent elements if they have the same number of set bits. You are allowed to do this operation any number of times (including zero).

Return true if you can sort the array, else return false.

Read more
[LeetCode] Divide an Array Into Subarrays With Minimum Cost I

3010. Divide an Array Into Subarrays With Minimum Cost I

You are given an array of integers nums of length n.

The cost of an array is the value of its first element. For example, the cost of [1,2,3] is 1 while the cost of [3,4,1] is 3.

You need to divide nums into 3 disjoint contiguous subarrays.

Return the minimum possible sum of the cost of these subarrays.

Read more
[Codeforces] Round 734 (Div. 3) D2. Domino (hard version)Read more
[Codeforces] Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2) E. Permutation ShiftRead more