0PricingLogin
Competitive Programming Academy · Lesson

Dictionaries as Lookup Tables

Map keys to values for fast access.

The Dictionary Idea

A dictionary maps keys to values, letting you fetch a stored answer by name instead of scanning. It is your contest lookup table. 🔑

Constant-Time Access

Like a set, a dict hashes the key, so reading and writing are roughly O(1). That speed is why it replaces slow linear searches.

All lessons in this course

  1. Sets for Membership and Dedup
  2. Dictionaries as Lookup Tables
  3. Counter and defaultdict in Action
  4. Group and Bucket with a Map
← Back to Competitive Programming Academy