Must-do problems: Dictionaries and Sets
90 min ยท Beginner
Need help? Ask a tutor on WhatsApp (opens in a new tab)These are the dictionary and set problems every Python beginner should be able to solve, from a simple lookup to Two Sum, grouped anagrams and the longest consecutive run. Try each one on a small input by hand first, then check your program against every test.
What you will learn
What you will learn
- Store and look up data with dictionaries, using get() and setdefault()
- Build frequency maps and group items under a key
- Use sets for fast membership checks, duplicates and set operations
- Solve Two Sum and similar problems in one pass with a hash table
Sign in to continue this lesson
Create an account to read every lesson, practise with the exercises and keep track of your progress.