Why is the brute-force approach less ideal here?

Practice this question from Sieve of Eratosthenes - Prime Marking Pattern Practice Quiz, with options and an explanation.

Question

Why is the brute-force approach less ideal here?

Option A — Correct answer

Repeated prime checks redo factor work for many numbers.

Option B

It always has better space complexity

Option C

It skips reading some inputs

Option D

It only works on strings

Explanation

Repeated prime checks redo factor work for many numbers.

Sieve of Eratosthenes - Prime Marking Pattern Practice Quiz

All questions · Previous question · Next question

Open on QuizMaker