🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Technical Interviews: all 10 questions

Quiz: Technical Interviews · Question 4 of 10

What is the time complexity of Two Sum with a hash map?

What is the time complexity of Two Sum with a hash map?

  1. A.O(n²)
  2. B.O(n)
  3. C.O(log n)
  4. D.O(1)
Answer & explanation

Correct answer: O(n)

One pass with constant-time lookups.

Can you get the rest right without peeking?

Take the timed Quiz: Technical Interviews quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →