3 ms·
The thing is, you don't need mod. You can, in more steps, arrive at the same output just using arithmetic. But everyone... non-programmers too... should under
by blunte 7y ago
The thing is, you don't need mod. You can, in more steps, arrive at the same output just using arithmetic. But everyone... non-programmers too... should understand the concept of "remainder after division" (of whole numbers).
If the test is interactive, the candidate can express, "I need to find out if this number is evenly divisible by that number; if so, then blah blah". Interviewer can remind them that x % 2 is "remainder of x when it is divided by 2". The point should not be whether someone can remember %, but whether they have any idea what minor goal they are trying to achieve.