4 ms·
It would actually be pretty easy to do without (explicit) multiplication or division: just convert it to a string and check text properties. Whether or not it w
by rflrob 15y ago
It would actually be pretty easy to do without (explicit) multiplication or division: just convert it to a string and check text properties. Whether or not it would be any faster is another question, to which I'm almost certain the answer is no.
istr = string(i)
if '5' in istr or istr[-1] == '0':
print "Buzz",
- unwind 15y agoFor that to be valid, in my opinion, you first have to write an integer-to-string converter that also doesn't use multiplication or division. From what I've seen (and written) of such code, that's not trivial.
- krallja 15y agoHmm... the printf("%d\n") in my solution uses division implicitly, for that very reason.