You are given an array of positive integers ’nums’. You can perform an operation on this array where you select two consecutive elements and replace one of them with the gcd (greatest common divisor) of the two elements. The goal is to make all elements of the array equal to 1 using the minimum number of operations. If it’s impossible to make all elements equal to 1, return -1.
You are given a three-digit integer n. We define a number as fascinating if, when you concatenate n, 2 * n, and 3 * n, the resulting number contains all digits from 1 to 9 exactly once and does not contain any zeros.
A truck has two fuel tanks, one main tank and one additional tank. The truck’s mileage is 10 km per liter, and fuel from the additional tank can be injected into the main tank after every 5 liters of fuel consumed. Your task is to calculate the maximum distance the truck can travel, considering both the main tank and the additional tank.
You are given an array ’nums’ containing integers. A pair of indices ‘i, j’ is considered beautiful if the first digit of nums[i] and the last digit of nums[j] are coprime. Two numbers are coprime if their greatest common divisor (GCD) is 1, i.e., ‘gcd(x, y) == 1’. Your task is to find the total number of beautiful pairs in nums.
You are given a binary array ’nums’ containing only 0s and 1s. A good subarray is defined as a contiguous subarray that contains exactly one 1. Your task is to find the number of ways to split the array into good subarrays. Return the result modulo (10^9 + 7).