3 ms·
There are other HN comments pointing out that the proposed solution still doesn't work correctly because of floating point operations. If the goal is to learn s
by rmetzler 7y ago
There are other HN comments pointing out that the proposed solution still doesn't work correctly because of floating point operations. If the goal is to learn something about programming, yes, I agree with you. But if the goal is to write code with as few bugs as possible then I would take the "create a string and count chars" solution over every solution involving floating point math.