You are viewing a single comment's thread. Return to all comments →
m using d same algorithm in python ...but doesnt pass 4 testcase ... Can anyone tell me why it is happening ?? my code is
def minimumSwaps(arr): swap=0 for i in range (len(arr)): if(arr[i]!=(i+1)): t=i; while(arr[t]!=(i+1)): t+=1 temp=arr[t] arr[t]=arr[i] arr[i]=temp swap+=1 return swap
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Swaps 2
You are viewing a single comment's thread. Return to all comments →
m using d same algorithm in python ...but doesnt pass 4 testcase ... Can anyone tell me why it is happening ?? my code is