Hacker News new | ask | show | jobs
by chipsy 5886 days ago
The main danger with using the mod operator is that you can get an off-by-one if you aren't in the habit of using it and forget the exact definition. If that's in doubt, rolling your own thing with a division or a while/if makes for a stronger guarantee of success on the first try.

In an interview you could explain your reasoning for such a detour as well, which might work out better than just "knowing the answer."