🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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 →
  1. Q1. What is the time complexity of this code? (code)
  2. Q2. What is the time complexity of this code? (code)
  3. Q3. What is the time complexity of this loop? (code)
  4. Q4. Simplify the complexity 3n² + 5n + 100.
  5. Q5. An array has n ≤ 100,000 elements. Which solution is likely too slow for a typical 1-second limit?
  6. Q6. Which operations are O(1) on average? (select all that apply)
  7. Q7. What is the extra space complexity of this recursive function? (code)
  8. Q8. You loop over array a (length n) and, inside it, over array b (length m). What is the time complexity?