[Codeforces] COMPFEST 15 - Preliminary Online Mirror (Unrated, ICPC Rules, Teams Preferred) G. Grouped CarriagesRead more
[Codeforces] COMPFEST 15 - Preliminary Online Mirror (Unrated, ICPC Rules, Teams Preferred) H. Happy SetsRead more
[Codeforces] Hello 2024 D. 01 TreeRead more
[LeetCode] Count the Number of Powerful Integers

10034. Count the Number of Powerful Integers

You are given three integers start, finish, and limit. You are also given a 0-indexed string s representing a positive integer.

A positive integer x is called powerful if it ends with s (in other words, s is a suffix of x) and each digit in x is at most limit.

Return the total number of powerful integers in the range [start..finish].

A string x is a suffix of a string y if and only if x is a substring of y that starts from some index (including 0) in y and extends to the index y.length - 1. For example, 25 is a suffix of 5125 whereas 512 is not.

Read more
[LeetCode] Minimum Number of Operations to Make X and Y Equal

10032. Minimum Number of Operations to Make Array XOR Equal to K

You are given two positive integers x and y.

In one operation, you can do one of the four following operations:

  1. Divide x by 11 if x is a multiple of 11.
  2. Divide x by 5 if x is a multiple of 5.
  3. Decrement x by 1.
  4. Increment x by 1.

Return the minimum number of operations required to make x and y equal.

Read more
[LeetCode] Minimum Number of Operations to Make Array XOR Equal to K

10033. Minimum Number of Operations to Make X and Y Equal

You are given a 0-indexed integer array nums and a positive integer k.

You can apply the following operation on the array any number of times:

  • Choose any element of the array and flip a bit in its binary representation. Flipping a bit means changing a 0 to 1 or vice versa.

Return the minimum number of operations required to make the bitwise XOR of all elements of the final array equal to k.

Note that you can flip leading zero bits in the binary representation of elements. For example, for the number (101)2 you can flip the fourth bit and obtain (1101)2.

Read more
[LeetCode] Smallest Missing Integer Greater Than Sequential Prefix Sum

10031. Smallest Missing Integer Greater Than Sequential Prefix Sum

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

A prefix nums[0..i] is sequential if, for all 1 <= j <= i, nums[j] = nums[j - 1] + 1. In particular, the prefix consisting only of nums[0] is sequential.

Return the smallest integer x missing from nums such that x is greater than or equal to the sum of the longest sequential prefix.

Read more
[Codeforces] Round 896 (Div. 1) B2. Candy Party (Hard Version)Read more
[Codeforces] Round 902 (Div. 1, based on COMPFEST 15 - Final Round) C. AutosynthesisRead more
[Codeforces] Round 904 (Div. 2) D. Counting RhymeRead more