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.
q=int(input())foriinrange(q):n=int(input())l=len(bin(n))-2#length of bin nums=''foriinrange(l-1):s+='1'k=int(s,2)+1#Get power of 2 less than nifn!=k:#If n and k are n not equal, then it means Richard uses first step to make value to power of two.l+=1#In a l length number, the game is performed by l+1 times now because n!=k. So increment lifl%2==0:#If l is even, Richard wins.print('Richard')else:#Else Louise wins.print('Louise')
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Counter game
You are viewing a single comment's thread. Return to all comments →
Can you please detect error in my approach?