[Codeforces] School Regional Team Contest, Saratov, 2011 D. Three SonsRead more
[Codeforces] Codeforces Beta Round #85 (Div. 1 Only) A. Petya and InequiationsRead more
[Codeforces] School Regional Team Contest, Saratov, 2011 E. Put Knight!Read more
[LeetCode] Merge Similar Items

2363. Merge Similar Items

You are given two 2D integer arrays, items1 and items2, representing two sets of items. Each array items has the following properties:

  • items[i] = [valuei, weighti] where valuei represents the value and weighti represents the weight of the ith item.
  • The value of each item in items is unique.

Return a 2D integer array ret where ret[i] = [valuei, weighti], with weighti being the sum of weights of all items with value valuei.

Note: ret should be returned in ascending order by value.

Read more
[LeetCode] Count Number of Bad Pairs

2364. Count Number of Bad Pairs

You are given a 0-indexed integer array nums. A pair of indices (i, j) is a bad pair if i < j and j - i != nums[j] - nums[i].

Return the total number of bad pairs in nums.

Read more
[LeetCode] Task Scheduler II

2365. Task Scheduler II

You are given a 0-indexed array of positive integers tasks, representing tasks that need to be completed in order, where tasks[i] represents the type of the ith task.

You are also given a positive integer space, which represents the minimum number of days that must pass after the completion of a task before another task of the same type can be performed.

Each day, until all tasks have been completed, you must either:

  • Complete the next task from tasks, or
  • Take a break.

Return the minimum number of days needed to complete all tasks.

Read more
[LeetCode] Minimum Replacements to Sort the Array

2366. Minimum Replacements to Sort the Array

You are given a 0-indexed integer array nums. In one operation you can replace any element of the array with any two elements that sum to it.

  • For example, consider nums = [5,6,7]. In one operation, we can replace nums[1] with 2 and 4 and convert nums to [5,2,4,7].

Return the minimum number of operations to make an array that is sorted in non-decreasing order.

Read more
[AtCoder] C - 2D Plane 2N PointsRead more
[AtCoder] D - Grid ComponentsRead more
[AtCoder] C - Traveling PlanRead more