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.
defdecentNumber(n):three,five='33333','555'q3,r3=divmod(n,3)ifr3==0:returnfive*q3# decrements quotient of q3 and increments r3 to see if divisible by 5# this is done so that we get as many 5's as possible whileq3>0:r3+=3q3-=1q,r=divmod(r3,5)ifr==0:return(five*q3)+(three*q)return-1
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →
Python