Why is the brute-force approach less ideal here?
Practice this question from XOR From 1 to N - Modulo Cycle Pattern Practice Quiz, with options and an explanation.
Question
Why is the brute-force approach less ideal here?
Option A — Correct answer
Looping from 1 to n is linear.
Option B
It always uses less memory
Option C
It avoids all edge cases
Option D
It does not read the input
Explanation
Looping from 1 to n is linear.