• + 1 comment
    def modifySequence(arr):
        c=0
        # Write your code here
        for v,i in enumerate(arr):
            if v in range(len(arr)-1):
                if arr[v]>=arr[v+1]:
                   c=c+1
                   x = random.randint(arr[v],arr[v+2])
                   k=1 if x==arr[v+1] else 0
                   arr[v+1]=x
                   if k==1:
                    c=c+1
        return c