← Time & Space Complexity Quiz: all 8 questions
Time & Space Complexity Quiz · Question 8 of 8
You loop over array a (length n) and, inside it, over array b (length m). What is the time complexity?
You loop over array a (length n) and, inside it, over array b (length m). What is the time complexity?
Answer & explanation
Correct answer: O(n*m)
Nested loops multiply, and different inputs keep different letters: O(n × m).
Can you get the rest right without peeking?
Take the timed Time & Space Complexity Quiz quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →