We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defwaiter(number,q):# Write your code hereanswer=[]point=0index=2whilepoint<q:check=0fornowinrange(1,index+1):ifindex%now==0:check+=1ifnow<indexandcheck==2:breakifcheck==2:point+=1A=[]B=[]foriinrange(len(number)):ifnumber[i]%index==0:A.append(number[i])else:B.append(number[i])ifpoint<q:B.reverse()number=Banswer.extend(A)index+=1answer.extend(number)returnanswer
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Waiter
You are viewing a single comment's thread. Return to all comments →
pytohn 3