Graph problems in Python
Paths, cycles and components in networks of nodes and edges, as Python problems with tests.
Beginner
Intermediate
- 61. One-Way StreetsCan you drive to your destination without going the wrong way?60 XP10 min
- 79. Count the IslandsHow many separate islands are on this map?70 XP12 min
- 81. Friend GroupsHow many separate circles of friends are there?70 XP12 min
- 105. Escape the MazeWhat is the quickest way out of the maze?85 XP15 min
- 271. Keys in Locked RoomsKeys hide inside locked rooms: how far can you get?60 XP10 min
- 337. Fewest Stops on the MetroThe metro trip with the fewest stops85 XP18 min
Advanced
- 118. WildfireHow long until the whole forest has burned?110 XP18 min
- 124. Split Into Two TeamsCan rivals always end up on opposite teams?115 XP20 min
- 146. Course OrderIn what order can you take every course?135 XP25 min
- 159. Cheapest Cable NetworkConnect every house for the least money145 XP25 min
- 161. Signal DelayHow long until a message reaches every computer?150 XP25 min
- 353. Open the LockSpin the wheels of a lock without hitting a jam120 XP20 min
- 369. Most Reliable RouteWhich route gives a fragile message its best chance?130 XP25 min
- 377. One Cable Too ManyOne extra cable turned a tidy network into a loop135 XP25 min
- 381. Back Before You LeftCan you arrive home before you set off?140 XP25 min
- 396. The Quietest TownWhich town has the fewest neighbours within a short drive?140 XP25 min
- 404. Chains of ConversionsMiles to inches, cups to gallons: follow the chain150 XP30 min
- 418. Alien AlphabetWork out a strange alphabet from a page of its dictionary160 XP35 min
Expert
- 179. Word LadderTurn one word into another, one letter at a time210 XP35 min
- 186. Cheapest Trip with Few StopsThe best fare when you can only change planes so many times235 XP40 min
- 433. Fewest BusesGet across town changing buses as few times as possible200 XP35 min
- 453. Critical CablesWhich single cable would split the network if it broke?230 XP45 min
- 461. Strongly Connected GroupsGroups of web pages that can all reach each other230 XP45 min
- 463. Best Exchange RateSwap money through a chain of currencies, unless the chain prints money240 XP45 min
- 473. The Night RoundThe shortest round that checks every room of a building240 XP45 min
- 481. Use Every TicketA pile of plane tickets and one trip that uses them all250 XP50 min
- 492. Pipe Network FlowHow much water can the pipes carry to the city?270 XP55 min
Other topics
- Python Basics
- Strings
- Lists
- Dictionaries and sets
- Loops
- Functions
- Math
- Sorting and searching
- Two pointers
- Sliding window
- Stacks and queues
- Recursion and backtracking
- Dynamic programming
- Greedy
- Trees
- Bit manipulation
- Classes
- Iterators and generators
- Parsing
- Simulation
- Python idioms
- Regular expressions
- Codes and ciphers
- Working with data
- Grids and matrices
- Geometry
- Games and puzzles
- Heaps
- Data structures
Or see every challenge, with study plans, today's challenge and duels.