S
Seoffix.com
Sign In Get Pro Membership

DSA & Problem Solving

Big O and Counting Work

Intermediate Python 30 XP

Big O and Counting Work

Big O describes how work grows with input size. A single loop is O(n); a dictionary lookup is O(1).

Example

seen = {}
seen["a"] = True
print("a" in seen)

Your task

Return whether a value appears in a list using a set for O(1) lookups.

Hints

  1. Build set(items)
  2. Use the in operator

Check your understanding

Answer every question to pass.
1. What is the cost of one pass over n items?

Your answer

This lesson is checked against the lesson rules. Your code is never run on our servers.

AI Code Explainer & Translator

Runs without any outside service.
 
Mark Complete & Earn XP
Earn 30 XP after you pass the quiz. Finish every lesson in the track to earn its certificate.
Sign in to earn XP

DSA & Problem Solving

Lessons in this track
Questions about this lesson? Ask the Coding & Web Dev squad. Discuss in Community