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.
It took quiet a time to figure out the solution for me and here is my solution:
funccounterGame(nint64)string{// Write your code herelouiseWins:=falseforn!=1{if(n&(n-1))==0{n/=2}else{val:=strconv.FormatInt(n,2)prevPowerOf2:=1<<(len(val)-1)n-=int64(prevPowerOf2)}louiseWins=!louiseWins}iflouiseWins{return"Louise"}return"Richard"}
But I am amazed by others solution, it is just and understanding of binary theory.
Counter game
You are viewing a single comment's thread. Return to all comments →
It took quiet a time to figure out the solution for me and here is my solution:
But I am amazed by others solution, it is just and understanding of binary theory.