Company: Infosys_1aug
Difficulty: medium
Minimum Increment Operations to Make the Array Increasing You are given an array nums of N positive integers. In one operation, you may add 1 to any one array element. Find the minimum total number of operations required so that both of these conditions hold: The array is strictly increasing. For every 0-based position i , nums[i] is divisible by i + 1 . Input Format The first line contains N , the length of the array. The second line contains N space-separated integers nums[0], nums[1], ..., nums[N-1] . Output Format Print the minimum total number of increment operations. Constraints 1 ≤ N ≤ 5,000 1 ≤ nums[i] ≤ 10,000 Use 64-bit arithmetic for the operation count. Examples Example 1 Input: 3 1 2 3 Output: 0 Example 2 Input: 4 4 2 1 3 Output: 21 Explanation: The cheapest final array is 4 6 9 12 , requiring 0 + 4 + 8 + 9 = 21 increments. Example 3 Input: 3 2 5 2 Output: 8 Explanation: The cheapest final array is 2 6 9 , requiring 0 + 1 + 7 = 8 increments. Notes Elements may only be incr