Tally the Divisible Slots
Basic SolvedA scheduling report needs to know how many slot numbers from 1 to n are divisible by either 3 or 5, the two cadence intervals the team uses.
Implement `solve(Integer n)` to return how many integers from 1 to `n` (inclusive) are divisible by 3 or by 5.
Examples
Input
n = 15Output
7Input
n = 5Output
2Hints
- Loop 1..n; count when Math.mod(i,3)==0 OR Math.mod(i,5)==0.
Tests
Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.