[CS Academy] Hamming DistancesRead more
[CS Academy] Graph GameRead more
[CS Academy] Triangular UpdatesRead more
[Codeforces] Abbyy Cup 2.0 - Final (unofficial) D9. The Beaver`s Problem - 3Read more
[Codeforces] Abbyy Cup 2.0 - Final (unofficial) D1. The Beaver`s Problem - 3Read more
[Codeforces] Round 133 (Div. 2) C. Hiring StaffRead more
[Codeforces] Round 136 (Div. 1) B. Little Elephant and ArrayRead more
[Codeforces] Round 137 (Div. 2) C. Reducing FractionsRead more
[LeetCode] Maximum Sum Queries

2736. Maximum Sum Queries

You are given two 0-indexed integer arrays nums1 and nums2, each of length n, and a 1-indexed 2D array queries where queries[i] = [xi, yi].

For the ith query, find the maximum value of nums1[j] + nums2[j] among all indices j (0 <= j < n), where nums1[j] >= xi and nums2[j] >= yi, or -1 if there is no j satisfying the constraints.

Return an array answer where answer[i] is the answer to the ith query.

Read more
[LeetCode] Collecting Chocolates

2735. Collecting Chocolates

You are given a 0-indexed integer array nums of size n representing the cost of collecting different chocolates. Each chocolate is of a different type, and originally, the chocolate at ith index is of ith type.

In one operation, you can do the following with an incurred cost of x:

  • Simultaneously change the chocolate of ith type to (i + 1)th type for all indexes i where 0 <= i < n - 1. When i == n - 1, that chocolate will be changed to type of the chocolate at index 0.

Return the minimum cost to collect chocolates of all types, given that you can perform as many operations as you would like.

Read more