[Codeforces] Educational Round 93 (Rated for Div. 2) D. Colored RectanglesRead more
[Codeforces] Round 665 (Div. 2) D. Maximum Distributed TreeRead more
[LeetCode] Minimum Number of Operations to Make All Array Elements Equal to 1

2654. Minimum Number of Operations to Make All Array Elements Equal to 1

You are given a 0-indexed array nums consisiting of positive integers. You can do the following operation on the array any number of times:

  • Select an index i such that 0 <= i < n - 1 and replace either of nums[i] or nums[i+1] with their gcd value.

Return the minimum number of operations to make all elements of nums equal to 1. If it is impossible, return -1.

The gcd of two integers is the greatest common divisor of the two integers.

Read more
[LeetCode] Sliding Subarray Beauty

2653. Sliding Subarray Beauty

Given an integer array nums containing n integers, find the beauty of each subarray of size k.

The beauty of a subarray is the xth smallest integer in the subarray if it is negative, or 0 if there are fewer than x negative integers.

Return an integer array containing n - k + 1 integers, which denote the beauty of the subarrays in order from the first index in the array.

  • A subarray is a contiguous non-empty sequence of elements within an array.
Read more
[LeetCode] Sum Multiples

2652. Sum Multiples

Given a positive integer n, find the sum of all integers in the range [1, n] inclusive that are divisible by 3, 5, or 7.

Return an integer denoting the sum of all numbers in the given range satisfying the constraint.

Read more
[LeetCode] Calculate Delayed Arrival Time

2651. Calculate Delayed Arrival Time

You are given a positive integer arrivalTime denoting the arrival time of a train in hours, and another positive integer delayedTime denoting the amount of delay in hours.

Return the time when the train will arrive at the station.

Note that the time in this problem is in 24-hours format.

Read more
[AtCoder] B - XYYYXRead more
[AtCoder] F - Minimum Bounding Box 2Read more
[AtCoder] G - Constrained Nim 2Read more
[AtCoder] F - Simultaneous SwapRead more