An image service only produces thumbnail widths whose prime factors are all 2, 3, or 5, because those sizes scale cleanly.
Write isCleanSize(n) that returns true if n has no prime factor other than 2, 3, and 5, and false otherwise. 1 has no prime factors at all, so it counts as clean.
Input: n = 30 Output: true
30 = 2 × 3 × 5.
Input: n = 14 Output: false
14 = 2 × 7, and 7 is not allowed.
1 <= n <= 2^31 - 1Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #648 Only Small Prime Factors. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.