[LeetCode] Insert Greatest Common Divisors in Linked List

2807. Insert Greatest Common Divisors in Linked List

Given the head of a linked list head, in which each node contains an integer value.

Between every pair of adjacent nodes, insert a new node with a value equal to the greatest common divisor of them.

Return the linked list after insertion.

The greatest common divisor of two numbers is the largest positive integer that evenly divides both numbers.

Read more
[LeetCode] Minimum Seconds to Equalize a Circular Array

2808. Minimum Seconds to Equalize a Circular Array

You are given a 0-indexed array nums containing n integers.

At each second, you perform the following operation on the array:

  • For every index i in the range [0, n - 1], replace nums[i] with either nums[i], nums[(i - 1 + n) % n], or nums[(i + 1) % n].

Note that all the elements get replaced simultaneously.

Return the minimum number of seconds needed to make all elements in the array nums equal.

Read more
[LeetCode] Minimum Time to Make Array Sum At Most x

2809. Minimum Time to Make Array Sum At Most x

You are given two 0-indexed integer arrays nums1 and nums2 of equal length. Every second, for all indices 0 <= i < nums1.length, value of nums1[i] is incremented by nums2[i]. After this is done, you can do the following operation:

  • Choose an index 0 <= i < nums1.length and make nums1[i] = 0.

You are also given an integer x.

Return the minimum time in which you can make the sum of all elements of nums1 to be less than or equal to x, or -1 if this is not possible.

Read more
[Codeforces] Round 502 (in memory of Leopoldo Taravilse, Div. 1 + Div. 2) D. The WuRead more
[Codeforces] Round 506 (Div. 3) D. Concatenated MultiplesRead more
[Codeforces] Technocup 2019 - Elimination Round 2 D. Minimum pathRead more
[Codeforces] Technocup 2019 - Elimination Round 3 D. Barcelonian DistanceRead more
[Codeforces] Educational Round 50 (Rated for Div. 2) C. Classy NumbersRead more
[CS Academy] Expected LcpRead more
[CS Academy] Final ARead more