[LeetCode] Count Almost Equal Pairs I

3265. Count Almost Equal Pairs I

You are given an array nums consisting of positive integers.

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

  • 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 I

3264. Final Array State After K Multiplication Operations I

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.

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

Read more
[Codeforces] Round 935 (Div. 3) F. Kirill and MushroomsRead more
[Codeforces] Round 927 (Div. 3) F. Feed CatsRead more
[Codeforces] Round 926 (Div. 2) D. Sasha and a Walk in the CityRead more
[Codeforces] Round 924 (Div. 2) D. Lonely Mountain DungeonsRead more
[LeetCode] Number Complement

476. Number Complement

The complement of an integer is the integer you get when you flip all the 0‘s to 1‘s and all the 1‘s to 0‘s in its binary representation.

  • For example, The integer 5 is "101" in binary and its complement is "010" which is the integer 2.

Given an integer num, return its complement.

Read more
[Codeforces] Round 923 (Div. 3) F. MicrocycleRead more
[Codeforces] Round 928 (Div. 4) G. Vlad and Trouble at MITRead more
[Codeforces] Round 921 (Div. 2) D. Good TripRead more