Please use Laptop/Desktop or any other large screen for the Mock Interview Session.

Count primes and find super ugly number



YouTube Video Thumbnail
Link

Watch above sample mock interview video to see how it works.
Login and Buy Premium to Start the Interview



Count Prime Numbers

Count Prime Numbers

Problem Statement

Determine how many prime numbers exist that are smaller than a given non-negative integer m.

Examples

Example 1:
Input: 15
Output: 6
Explanation: The prime numbers less than 15 are 2, 3, 5, 7, 11, and 13.

Example 2:
Input: 7
Output: 4
Explanation: The prime numbers less than 7 are 2, 3, 5, and 7 is not counted since we consider numbers strictly less than the input.

Constraints

  • 0 ≤ m ≤ 5,000,000