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.
stringsolve(intn){inti=1;while(true){// Convert i to binary stringstringbinary="";inttemp=i;while(temp>0){binary=(temp%2==0?'0':'9')+binary;temp/=2;}// Convert to integer and check divisibilitylonglongcandidate=stoll(binary);if(candidate%n==0){returnbinary;}i++;}return"";}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Special Multiple
You are viewing a single comment's thread. Return to all comments →