Untitled
int prev = nums.back(); long long count = 0; for(int i = nums.size() - 2; i >= 0; --i) { long long cur = nums[i]; // Since num >= 1, div is never zero int div = (cur - 1) / prev + 1; count += div - 1; prev = cur / div; } return count;
int prev = nums.back(); long long count = 0; for(int i = nums.size() - 2; i >= 0; --i) { long long cur = nums[i]; // Since num >= 1, div is never zero int div = (cur - 1) / prev + 1; count += div - 1; prev = cur / div; } return count;