Quiz Python: Python Coding Interview Questions

This Python quiz prepares you for the coding round of an interview. It tests the Big-O cost of common operations, which data structure fits a problem, and patterns like two pointers, hash map lookups, memoization and binary search.

Difficile 10 domande ~8 minuti Superato con il 80% Python 3.12

Scegli una modalità

Stai giocando come ospite: accedi per salvare XP e serie.

Domanda di esempio

Domanda 1 di 10

What is the average time complexity of x in s when s is a set with n items?

Mostra la risposta

C. O(1) Sets and dicts are hash tables, so finding an item takes constant time on average. The same x in s on a list is O(n), because Python checks items one by one.

Cosa copre questo quiz

  • Big-O of in, pop and other list, set and dict operations
  • Picking a set, dict, deque or heap for a task
  • Two pointers and the dict-based two-sum
  • Recursion limits and memoization with lru_cache
  • Binary search with bisect

Domande frequenti

Serve un account?

No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.

Quale versione di Python?

Python 3.12. Ogni domanda sull'output è stata verificata eseguendo il codice.

Posso rifarlo?

Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.