4 ms·
The +1 makes the range inclusive rather than exclusive. This matches the summary, which is inclusive of floor(500/k). Ceil wouldn't correctly handle the case wh
by akovaski 7y ago
The +1 makes the range inclusive rather than exclusive. This matches the summary, which is inclusive of floor(500/k). Ceil wouldn't correctly handle the case where the number of rooms equals a perfect square. That is,
[k**2 for k in range(1, ceil(484**0.5))]
does not return 484.
- geocar 7y agoQuite right! So a 1+ is needed. I can't amend my comment to that point, but the original comment didn't have +1 in there anyway.