[Codeforces] Educational Round 165 (Rated for Div. 2) D. Shop GameRead more
[Codeforces] Round 943 (Div. 3) G1. Division + LCP (easy version)Read more
[Codeforces] Round 940 (Div. 2) and CodeCraft-23 D. A BIT of an InequalityRead more
[Codeforces] Round 938 (Div. 3) G. GCD on a gridRead more
[Codeforces] Round 937 (Div. 4) G. Shuffling SongsRead more
[Codeforces] European Championship 2024 - Online Mirror (Unrated, ICPC Rules, Teams Preferred) C. Annual Ants` GatheringRead more
[Codeforces] Round 936 (Div. 2) D. Birthday GiftRead more
[LeetCode] N-ary Tree Postorder Traversal

590. N-ary Tree Postorder Traversal

Given the root of an n-ary tree, return the postorder traversal of its nodes’ values.

Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by the null value (See examples)

Read more
[LeetCode] Count Almost Equal Pairs II

3267. Count Almost Equal Pairs II

Attention: In this version, the number of operations that can be performed, has been increased to twice.

You are given an array nums consisting of positive integers.

We call two integers x and y almost equal if both integers can become equal after performing the following operation at most twice:

  • Choose either x or y and swap any two digits within the chosen number.

Return the number of indices i and j in nums where i < j such that nums[i] and nums[j] are almost equal.

Note that it is allowed for an integer to have leading zeros after performing an operation.

Read more
[LeetCode] Final Array State After K Multiplication Operations II

3266. Final Array State After K Multiplication Operations II

You are given an integer array nums, an integer k, and an integer multiplier.

You need to perform k operations on nums. In each operation:

  • Find the minimum value x in nums. If there are multiple occurrences of the minimum value, select the one that appears first.
  • Replace the selected minimum value x with x * multiplier.

After the k operations, apply modulo 109 + 7 to every value in nums.

Return an integer array denoting the final state of nums after performing all k operations and then applying the modulo.

Read more