← All topics
Time & Space Complexity Quiz: questions with answers
8 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What is the time complexity of this code? (code)
- Q2. What is the time complexity of this code? (code)
- Q3. What is the time complexity of this loop? (code)
- Q4. Simplify the complexity 3n² + 5n + 100.
- Q5. An array has n ≤ 100,000 elements. Which solution is likely too slow for a typical 1-second limit?
- Q6. Which operations are O(1) on average? (select all that apply)
- Q7. What is the extra space complexity of this recursive function? (code)
- Q8. You loop over array a (length n) and, inside it, over array b (length m). What is the time complexity?