I have a problem in which we have an array of positive numbers and we have to make it strictly increasing by making zero or more changes to the array elements.
We ar
O(n) Running time:
def min_changes(li): change, check = 0, 0 li_len = len(li) if li_len in [0,1]: return change else: check = li[0] for i in range(1, len(li)): if check >= li[i]: li[i] = check +1 change += 1 check += 1 else: check = li[i] return change