Educational Codeforces Round 93 (Rated for Div. 2) D. Colored Rectangles
2654. Minimum Number of Operations to Make All Array Elements Equal to 1
You are given a 0-indexed array
numsconsisiting of positive integers. You can do the following operation on the array any number of times:
- Select an index
isuch that0 <= i < n - 1and replace either ofnums[i]ornums[i+1]with their gcd value.Return the minimum number of operations to make all elements of
numsequal to1. If it is impossible, return-1.The gcd of two integers is the greatest common divisor of the two integers.
Given an integer array
numscontainingnintegers, find the beauty of each subarray of sizek.The beauty of a subarray is the
xthsmallest integer in the subarray if it is negative, or0if there are fewer thanxnegative integers.Return an integer array containing
n - k + 1integers, 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.
Given a positive integer
n, find the sum of all integers in the range[1, n]inclusive that are divisible by3,5, or7.Return an integer denoting the sum of all numbers in the given range satisfying the constraint.
2651. Calculate Delayed Arrival Time
You are given a positive integer
arrivalTimedenoting the arrival time of a train in hours, and another positive integerdelayedTimedenoting 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.