How to make this code loop again and again?
arr = [1,2,3] Count = 0 step-1 sort the array Step-2 check if min(arr)==max(arr): break else: Step-3- iterate over the arr in range (len(arr)-1): arr[i]+=1 Count+=1 step-4 now again check if min(arr) == max(arr): break else: go to step 1 and repeat until all the elements become equal... For eg: [1,2,3] #here 1(min) and 3(max)..so by leaving the max element..we have to make the min element equal to to 3..so this is how we do it.. 1 2 3. 2 3 3. 1step 3 4 3. 2step 4 4 4. < Every element is equal now...and it was a 3 step process..so the Count = 3 I am having problems in implementation..so i need a lil help.. I made a working solution, but it take too long to give a solution for a very large array..like in range(1000) Link> https://code.sololearn.com/c1W10i4qNI3w/?ref=app