bit count or bit set && Python3
ian.g.kelly at gmail.com
Thu Oct 25 22:20:00 CEST 2012
On Thu, Oct 25, 2012 at 2:00 PM, Neil Cerutti <neilc at norwich.edu> wrote:
> Yes indeed! Python string operations are fast enough and its
> arithmetic slow enough that I no longer assume I can beat a neat
> lexicographical solution. Try defeating the following with
> def is_palindrom(n):
> s = str(n)
> return s = s[::-1]
Problems like these are fundamentally string problems, not math
problems. The question being asked isn't about some essential
property of the number, but about its digital representation.
Certainly they can be reasoned about mathematically, but the fact
remains that the math being done is about the properties of strings.
More information about the Python-list