A math-game leaderboard gives bonus points for prime scores. The designers want to know how many prime scores exist between low and high, both included.
Write countPrimesBetween(low, high) that returns that count.
Input: low = 10, high = 20 Output: 4
11, 13, 17, and 19 are the primes from 10 to 20.
Input: low = 1, high = 1 Output: 0
1 is not prime.
1 <= low <= high <= 10^6Run 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 #638 Count Primes in a Range. 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.