4 ms·
That's mentioned in the article, at the bottom, under the topic "Alternative, invalid solution": > As a result, solutions using strings are disallowed on probl
by crummy 7y ago
That's mentioned in the article, at the bottom, under the topic "Alternative, invalid solution":
> As a result, solutions using strings are disallowed on problem sets and quizzes until they are taught.
- lvncelot 7y agoAlso as a result, even the proposed solution is wrong for certain cases, takes longer, and doesn't convey what it's achieving as elegantly as `len(str(n))`. Because the length of the string representation is - exactly - what is being asked here. I get that sometimes the simplest solution to a problem is not teaching the right stuff, but in almost all cases that is a fault in the problem, not the solution.