pyPython Practice LabFrom first print to final round
BEGINNER → DSA → INTERVIEW READY

360 Python practice problems in one clear learning order

Build Python skill through scenario-based exercises instead of random questions. The roadmap starts with input and output, then progresses through functions, OOP, data structures, algorithms and technical interview patterns.

360 guided problems18 ordered topics5 readable previews
CURRICULUM

Choose a Python topic

Follow the numbered order if you are new to coding, or open the topic you need to revise.

COMPLETE PROBLEM INDEX

Practice by topic and difficulty

The first five pages include readable problem details and solutions. Premium pages explain the skill being tested before asking you to unlock the complete workspace.

01

Python Fundamentals and Input/Output

Start here. Practice input(), print(), variables, numbers, formatting, and small formulas.

  1. #001Echo a message: Coding club announcementStarterFree preview
  2. #002Echo a message: Preserve punctuationStarterFree preview
  3. #003Create a personal greeting: Welcome a learnerStarterFree preview
  4. #004Create a personal greeting: Name with spacesStarterFree preview
  5. #005Add two integers: Add two cart quantitiesStarterFree preview
  6. #006Add two integers: Handle a negative adjustmentStarterPremium
  7. #007Show basic arithmetic: Compare two measurementsStarterPremium
  8. #008Show basic arithmetic: Use a negative first valueStarterPremium
  9. #009Rectangle measurements: Floor matStarterPremium
  10. #010Rectangle measurements: Decimal dimensionsStarterPremium
  11. #011Convert Celsius to Fahrenheit: Weather displayStarterPremium
  12. #012Convert Celsius to Fahrenheit: Freezing referenceStarterPremium
  13. #013Calculate a purchase total: Notebook orderStarterPremium
  14. #014Calculate a purchase total: Single premium itemStarterPremium
  15. #015Convert seconds to clock time: Video durationStarterPremium
  16. #016Convert seconds to clock time: Short timerStarterPremium
  17. #017Swap two values: Swap seat labelsStarterPremium
  18. #018Swap two values: Swap signed readingsStarterPremium
  19. #019Average three scores: Quiz averageStarterPremium
  20. #020Average three scores: Scores with decimalsStarterPremium
02

Operators and Decision Making

Translate everyday rules into comparisons, Boolean expressions, and if/elif/else branches.

  1. #021Classify even or odd: Locker assignmentBeginnerPremium
  2. #022Classify even or odd: Negative integerBeginnerPremium
  3. #023Classify a number's sign: Profit indicatorBeginnerPremium
  4. #024Classify a number's sign: Break-even dayBeginnerPremium
  5. #025Find the larger of two values: Compare two bidsBeginnerPremium
  6. #026Find the larger of two values: Equal readingsBeginnerPremium
  7. #027Find the largest of three values: Highest test scoreBeginnerPremium
  8. #028Find the largest of three values: All negative temperaturesBeginnerPremium
  9. #029Detect a leap year: Modern leap yearBeginnerPremium
  10. #030Detect a leap year: Century exceptionBeginnerPremium
  11. #031Convert a score to a grade: Passing gradeBeginnerPremium
  12. #032Convert a score to a grade: Reject bad dataBeginnerPremium
  13. #033Set an age-based ticket price: Child visitorBeginnerPremium
  14. #034Set an age-based ticket price: Senior visitorBeginnerPremium
  15. #035Validate and classify a triangle: Equal-sided frameBeginnerPremium
  16. #036Validate and classify a triangle: Impossible frameBeginnerPremium
  17. #037Check a basic password policy: Accepted signupBeginnerPremium
  18. #038Check a basic password policy: Missing digitBeginnerPremium
  19. #039Calculate a shipping fee: Large guest orderBeginnerPremium
  20. #040Calculate a shipping fee: Small member orderBeginnerPremium
03

Loops and Number Problems

Build loop confidence with counters, accumulators, digit logic, primes, and classic sequences.

  1. #041Sum the first n integers: Weekly countersBeginnerPremium
  2. #042Sum the first n integers: Empty rangeBeginnerPremium
  3. #043Calculate a factorial: Arrangement countBeginnerPremium
  4. #044Calculate a factorial: Zero factorialBeginnerPremium
  5. #045Print a multiplication table: Practice tableBeginnerPremium
  6. #046Print a multiplication table: Negative tableBeginnerPremium
  7. #047Count digits in an integer: Large invoice numberBeginnerPremium
  8. #048Count digits in an integer: Signed single digitBeginnerPremium
  9. #049Reverse an integer: Reverse an access codeBeginnerPremium
  10. #050Reverse an integer: Negative value with zerosBeginnerPremium
  11. #051Check a numeric palindrome: Symmetric codeBeginnerPremium
  12. #052Check a numeric palindrome: Ordinary numberBeginnerPremium
  13. #053Test primality: Prime identifierBeginnerPremium
  14. #054Test primality: Small edge caseBeginnerPremium
  15. #055List primes up to n: Small prime catalogBeginnerPremium
  16. #056List primes up to n: Boundary primeBeginnerPremium
  17. #057Generate Fibonacci terms: Ten-term sequenceBeginnerPremium
  18. #058Generate Fibonacci terms: Single-term edge caseBeginnerPremium
  19. #059Find GCD and LCM: Align maintenance cyclesBeginnerPremium
  20. #060Find GCD and LCM: Coprime valuesBeginnerPremium
04

String Processing

Learn normalization, slicing, counting, searching, and transformation of real text.

  1. #061Reverse text: Reverse a labelBeginnerPremium
  2. #062Reverse text: Keep spacesBeginnerPremium
  3. #063Check a phrase palindrome: Classic phraseBeginnerPremium
  4. #064Check a phrase palindrome: Punctuation and caseBeginnerPremium
  5. #065Count vowels and consonants: Course nameBeginnerPremium
  6. #066Count vowels and consonants: Ignore digits and punctuationBeginnerPremium
  7. #067Count words: Short sentenceBeginnerPremium
  8. #068Count words: Extra spacingBeginnerPremium
  9. #069Count a chosen character: Count a letterBeginnerPremium
  10. #070Count a chosen character: Case-sensitive countBeginnerPremium
  11. #071Remove duplicate characters: Compress repeated lettersBeginnerPremium
  12. #072Remove duplicate characters: Spaces are charactersBeginnerPremium
  13. #073Check for anagrams: Simple anagramBeginnerPremium
  14. #074Check for anagrams: Phrase anagramBeginnerPremium
  15. #075Find the first nonrepeating character: Unique letter existsBeginnerPremium
  16. #076Find the first nonrepeating character: No unique letterBeginnerPremium
  17. #077Run-length encode text: Repeated groupsBeginnerPremium
  18. #078Run-length encode text: No repeated neighborsBeginnerPremium
  19. #079Find the longest word: Course descriptionBeginnerPremium
  20. #080Find the longest word: Tie behaviorBeginnerPremium
05

Lists, Tuples, and Matrices

Use sequence operations and common array patterns, then move into matrix processing.

  1. #081Calculate list sum and average: Daily salesBeginnerPremium
  2. #082Calculate list sum and average: Decimal measurementsBeginnerPremium
  3. #083Find largest and second largest: Contest scoresBeginnerPremium
  4. #084Find largest and second largest: Negative valuesBeginnerPremium
  5. #085Remove list duplicates in order: Clean survey codesBeginnerPremium
  6. #086Remove list duplicates in order: Already uniqueBeginnerPremium
  7. #087Rotate a list to the right: Shift duty rosterBeginnerPremium
  8. #088Rotate a list to the right: Rotation larger than lengthBeginnerPremium
  9. #089Move zeros to the end: Clean sparse readingsBeginnerPremium
  10. #090Move zeros to the end: No zerosBeginnerPremium
  11. #091Merge two sorted lists: Merge rank listsBeginnerPremium
  12. #092Merge two sorted lists: Duplicates across listsBeginnerPremium
  13. #093Find a missing number: Missing attendance IDBeginnerPremium
  14. #094Find a missing number: Missing boundaryBeginnerPremium
  15. #095Find two-sum indexes: Price pairBeginnerPremium
  16. #096Find two-sum indexes: Pair containing a negativeBeginnerPremium
  17. #097Find the maximum subarray sum: Best profit streakBeginnerPremium
  18. #098Find the maximum subarray sum: All lossesBeginnerPremium
  19. #099Transpose a matrix: Rectangular tableBeginnerPremium
  20. #100Transpose a matrix: Single rowBeginnerPremium
06

Sets and Dictionaries

Choose sets for membership and dictionaries for relationships, grouping, and frequency tables.

  1. #101Calculate set union and intersection: Shared course IDsIntermediatePremium
  2. #102Calculate set union and intersection: Disjoint choicesIntermediatePremium
  3. #103Count unique words: Repeated topic wordsIntermediatePremium
  4. #104Count unique words: All repeatedIntermediatePremium
  5. #105Build a word-frequency table: Analyze feedbackIntermediatePremium
  6. #106Build a word-frequency table: Single vocabulary itemIntermediatePremium
  7. #107Calculate a student's average: Three assessmentsIntermediatePremium
  8. #108Calculate a student's average: Decimal resultsIntermediatePremium
  9. #109Update inventory: Deliveries and salesIntermediatePremium
  10. #110Update inventory: Prevent negative stockIntermediatePremium
  11. #111Group anagrams: Several word familiesIntermediatePremium
  12. #112Group anagrams: No matchesIntermediatePremium
  13. #113Invert a dictionary: Code lookupIntermediatePremium
  14. #114Invert a dictionary: Numeric-looking valuesIntermediatePremium
  15. #115Find the top k frequent values: Top two product codesIntermediatePremium
  16. #116Find the top k frequent values: Frequency tieIntermediatePremium
  17. #117Merge numeric dictionaries: Combine branch salesIntermediatePremium
  18. #118Merge numeric dictionaries: No shared keysIntermediatePremium
  19. #119Build an adjacency list: Small networkIntermediatePremium
  20. #120Build an adjacency list: Include an isolated vertexIntermediatePremium
07

Functions and Functional Tools

Write reusable functions and meet lambda, map, filter, reduce, closures, generators, and decorators.

  1. #121Reuse a prime-checking function: Prime function true caseIntermediatePremium
  2. #122Reuse a prime-checking function: Prime function false caseIntermediatePremium
  3. #123Calculate tax with an optional rate: Standard taxIntermediatePremium
  4. #124Calculate tax with an optional rate: Reduced taxIntermediatePremium
  5. #125Average any number of values: Four ratingsIntermediatePremium
  6. #126Average any number of values: One readingIntermediatePremium
  7. #127Sort records with a lambda: LeaderboardIntermediatePremium
  8. #128Sort records with a lambda: Tie by nameIntermediatePremium
  9. #129Square values with map: Positive sequenceIntermediatePremium
  10. #130Square values with map: Signed sequenceIntermediatePremium
  11. #131Filter passing scores: Standard pass markIntermediatePremium
  12. #132Filter passing scores: Everyone passesIntermediatePremium
  13. #133Multiply values with reduce: Package combinationsIntermediatePremium
  14. #134Multiply values with reduce: Zero factorIntermediatePremium
  15. #135Create a discount closure: Festival discountIntermediatePremium
  16. #136Create a discount closure: No discountIntermediatePremium
  17. #137Generate a countdown: Launch countdownIntermediatePremium
  18. #138Generate a countdown: Immediate finishIntermediatePremium
  19. #139Log a function call with a decorator: Log a greetingIntermediatePremium
  20. #140Log a function call with a decorator: Forward a spaced argumentIntermediatePremium
08

Recursion and Backtracking

Understand base cases, shrinking subproblems, recursive search, and choice-and-undo backtracking.

  1. #141Compute factorial recursively: Recursive arrangement countIntermediatePremium
  2. #142Compute factorial recursively: Recursive base caseIntermediatePremium
  3. #143Sum digits recursively: ChecksumIntermediatePremium
  4. #144Sum digits recursively: Negative inputIntermediatePremium
  5. #145Calculate integer power recursively: Large exponent efficientlyIntermediatePremium
  6. #146Calculate integer power recursively: Zero exponentIntermediatePremium
  7. #147Find GCD recursively: Shared factorIntermediatePremium
  8. #148Find GCD recursively: Second input zeroIntermediatePremium
  9. #149Binary search recursively: Found targetIntermediatePremium
  10. #150Binary search recursively: Missing targetIntermediatePremium
  11. #151Check a palindrome recursively: Odd-length palindromeIntermediatePremium
  12. #152Check a palindrome recursively: Early mismatchIntermediatePremium
  13. #153Generate all permutations: Three-character arrangementsIntermediatePremium
  14. #154Generate all permutations: Two-character arrangementsIntermediatePremium
  15. #155Generate all subsets: Feature subsetsIntermediatePremium
  16. #156Generate all subsets: Single valueIntermediatePremium
  17. #157Generate balanced parentheses: Three pairsIntermediatePremium
  18. #158Generate balanced parentheses: One pairIntermediatePremium
  19. #159Count N-Queens solutions: Classic four-queen boardIntermediatePremium
  20. #160Count N-Queens solutions: Five-queen boardIntermediatePremium
09

Files, Text Data, Exceptions, and Modules

Process file-like text safely and use Python's csv, json, datetime, pathlib, and exception tools.

  1. #161Count lines, words, and characters: Analyze a two-line noteIntermediatePremium
  2. #162Count lines, words, and characters: Blank line countsIntermediatePremium
  3. #163Total values from CSV rows: Small order CSVIntermediatePremium
  4. #164Total values from CSV rows: Decimal unit pricesIntermediatePremium
  5. #165Extract error log entries: Mixed application logIntermediatePremium
  6. #166Extract error log entries: No errorsIntermediatePremium
  7. #167Replace a word in text: Update a configuration noteIntermediatePremium
  8. #168Replace a word in text: No matching wordIntermediatePremium
  9. #169Divide safely with exceptions: Valid divisionIntermediatePremium
  10. #170Divide safely with exceptions: Zero denominatorIntermediatePremium
  11. #171Validate integer input: Accept signed integerIntermediatePremium
  12. #172Validate integer input: Reject decimal textIntermediatePremium
  13. #173Parse key-value configuration: Application settingsIntermediatePremium
  14. #174Parse key-value configuration: Value contains equalsIntermediatePremium
  15. #175Summarize JSON orders: Two JSON ordersIntermediatePremium
  16. #176Summarize JSON orders: Empty responseIntermediatePremium
  17. #177Calculate days between dates: Project durationIntermediatePremium
  18. #178Calculate days between dates: Cross a leap dayIntermediatePremium
  19. #179Count file extensions: Mixed project filesIntermediatePremium
  20. #180Count file extensions: Case and extensionless filesIntermediatePremium
10

Object-Oriented Python

Model state and behavior with classes, inheritance, composition, properties, and data classes.

  1. #181Model a rectangle class: Room objectIntermediatePremium
  2. #182Model a rectangle class: Decimal rectangleIntermediatePremium
  3. #183Model a bank account: Normal transactionsIntermediatePremium
  4. #184Model a bank account: Reject overdraftIntermediatePremium
  5. #185Model a student grade: Passing studentIntermediatePremium
  6. #186Model a student grade: Failing boundaryIntermediatePremium
  7. #187Build a shopping cart: Two-item cartIntermediatePremium
  8. #188Build a shopping cart: Empty cartIntermediatePremium
  9. #189Use inheritance for employees: Manager bonusIntermediatePremium
  10. #190Use inheritance for employees: Developer overtimeIntermediatePremium
  11. #191Protect temperature with a property: Valid temperatureIntermediatePremium
  12. #192Protect temperature with a property: Impossible temperatureIntermediatePremium
  13. #193Customize book display and equality: Same ISBNIntermediatePremium
  14. #194Customize book display and equality: Different ISBNIntermediatePremium
  15. #195Use a dataclass for inventory: Stock itemIntermediatePremium
  16. #196Use a dataclass for inventory: Zero quantityIntermediatePremium
  17. #197Model composition: Petrol carIntermediatePremium
  18. #198Model composition: Electric carIntermediatePremium
  19. #199Create a countdown iterator: Custom countdownIntermediatePremium
  20. #200Create a countdown iterator: Iterator edgeIntermediatePremium
11

Searching, Sorting, and Array Interviews

Practice the array, searching, sorting, interval, and hashing questions asked in interviews.

  1. #201Perform linear search: Find inventory codeInterviewPremium
  2. #202Perform linear search: Target missingInterviewPremium
  3. #203Perform iterative binary search: Find sorted recordInterviewPremium
  4. #204Perform iterative binary search: Outside the rangeInterviewPremium
  5. #205Find first and last occurrence: Repeated target rangeInterviewPremium
  6. #206Find first and last occurrence: Single occurrenceInterviewPremium
  7. #207Sort with bubble sort: Unsorted readingsInterviewPremium
  8. #208Sort with bubble sort: Already sortedInterviewPremium
  9. #209Sort with insertion sort: Nearly sorted scoresInterviewPremium
  10. #210Sort with insertion sort: Reverse orderInterviewPremium
  11. #211Sort with merge sort: General listInterviewPremium
  12. #212Sort with merge sort: Duplicates and negativesInterviewPremium
  13. #213Sort with quicksort: Quicksort practiceInterviewPremium
  14. #214Sort with quicksort: Many duplicate pivotsInterviewPremium
  15. #215Merge overlapping intervals: Meeting blocksInterviewPremium
  16. #216Merge overlapping intervals: Touching intervalsInterviewPremium
  17. #217Build product except self: Positive arrayInterviewPremium
  18. #218Build product except self: One zeroInterviewPremium
  19. #219Find the majority element: Clear majorityInterviewPremium
  20. #220Find the majority element: Short majorityInterviewPremium
12

Stacks, Queues, Linked Lists, Trees, and Graphs

Implement the core data structures and traversal patterns behind many technical interviews.

  1. #221Validate brackets with a stack: Nested expressionInterviewPremium
  2. #222Validate brackets with a stack: Wrong closing orderInterviewPremium
  3. #223Implement a queue with two stacks: Normal queue commandsInterviewPremium
  4. #224Implement a queue with two stacks: Empty queueInterviewPremium
  5. #225Reverse a linked list: Five-node listInterviewPremium
  6. #226Reverse a linked list: Single nodeInterviewPremium
  7. #227Find the middle linked-list node: Odd-length listInterviewPremium
  8. #228Find the middle linked-list node: Even-length conventionInterviewPremium
  9. #229Detect a linked-list cycle: Cycle to second nodeInterviewPremium
  10. #230Detect a linked-list cycle: Acyclic chainInterviewPremium
  11. #231Traverse a binary tree by levels: Three-level treeInterviewPremium
  12. #232Traverse a binary tree by levels: Single-node treeInterviewPremium
  13. #233Find binary-tree maximum depth: Unbalanced treeInterviewPremium
  14. #234Find binary-tree maximum depth: Empty treeInterviewPremium
  15. #235Validate a binary search tree: Valid BSTInterviewPremium
  16. #236Validate a binary search tree: Hidden violationInterviewPremium
  17. #237Traverse a graph with BFS: Connected graphInterviewPremium
  18. #238Traverse a graph with BFS: Disconnected graphInterviewPremium
  19. #239Find an unweighted shortest path: Route existsInterviewPremium
  20. #240Find an unweighted shortest path: Unreachable destinationInterviewPremium
13

Dynamic Programming and High-Frequency Interviews

Finish with high-frequency dynamic programming, grid, graph-ordering, and sliding-window problems.

  1. #241Count ways to climb stairs: Five stairsInterviewPremium
  2. #242Count ways to climb stairs: Zero stairsInterviewPremium
  3. #243Maximize nonadjacent house loot: Alternating opportunityInterviewPremium
  4. #244Maximize nonadjacent house loot: Two housesInterviewPremium
  5. #245Find minimum coins: Reachable amountInterviewPremium
  6. #246Find minimum coins: Impossible amountInterviewPremium
  7. #247Solve 0/1 knapsack: Choose best packageInterviewPremium
  8. #248Solve 0/1 knapsack: No item fitsInterviewPremium
  9. #249Find longest increasing subsequence length: Mixed sequenceInterviewPremium
  10. #250Find longest increasing subsequence length: Strictly decreasingInterviewPremium
  11. #251Find longest common subsequence length: Shared subsequenceInterviewPremium
  12. #252Find longest common subsequence length: No common charactersInterviewPremium
  13. #253Calculate edit distance: Classic conversionInterviewPremium
  14. #254Calculate edit distance: Empty targetInterviewPremium
  15. #255Find longest substring without repeats: Mixed repeatsInterviewPremium
  16. #256Find longest substring without repeats: All same characterInterviewPremium
  17. #257Count islands in a grid: Three islandsInterviewPremium
  18. #258Count islands in a grid: All waterInterviewPremium
  19. #259Topologically sort tasks: Valid build orderInterviewPremium
  20. #260Topologically sort tasks: Cyclic dependenciesInterviewPremium
14

Top Company Arrays, Strings, and Sliding Windows

Company-screen array and string patterns: two pointers, matrices, prefix sums, and sliding windows.

  1. #261Maximize one stock transaction: Profitable price historyCompany MediumPremium
  2. #262Maximize one stock transaction: Falling marketCompany MediumPremium
  3. #263Find unique three-sum triplets: Two valid tripletsCompany MediumPremium
  4. #264Find unique three-sum triplets: No zero-sum tripleCompany MediumPremium
  5. #265Maximize water between lines: Mixed container heightsCompany MediumPremium
  6. #266Maximize water between lines: Two-line minimumCompany MediumPremium
  7. #267Calculate trapped rain water: Classic elevation mapCompany HardPremium
  8. #268Calculate trapped rain water: No basinCompany HardPremium
  9. #269Find the longest consecutive run: Unsorted runCompany MediumPremium
  10. #270Find the longest consecutive run: Duplicates inside a runCompany MediumPremium
  11. #271Rotate a square matrix clockwise: Three-by-three imageCompany MediumPremium
  12. #272Rotate a square matrix clockwise: Two-by-two matrixCompany MediumPremium
  13. #273Read a matrix in spiral order: Rectangular spiralCompany MediumPremium
  14. #274Read a matrix in spiral order: Single columnCompany MediumPremium
  15. #275Set matrix rows and columns to zero: One internal zeroCompany MediumPremium
  16. #276Set matrix rows and columns to zero: Several original zerosCompany MediumPremium
  17. #277Count subarrays with target sum: Repeated target sumsCompany MediumPremium
  18. #278Count subarrays with target sum: Include negative valuesCompany MediumPremium
  19. #279Find the minimum covering window: Smallest covering substringCompany HardPremium
  20. #280Find the minimum covering window: Impossible coverageCompany HardPremium
15

Top Company Stacks, Heaps, Intervals, and Linked Lists

Practice cache design, monotonic structures, heaps, intervals, and advanced linked-list patterns.

  1. #281Merge k sorted lists: Three sorted feedsCompany HardPremium
  2. #282Merge k sorted lists: Single sourceCompany HardPremium
  3. #283Add numbers stored in linked lists: Different three-digit numbersCompany MediumPremium
  4. #284Add numbers stored in linked lists: Carry creates a new digitCompany MediumPremium
  5. #285Copy a random-pointer list: Mixed random linksCompany HardPremium
  6. #286Copy a random-pointer list: No random linksCompany HardPremium
  7. #287Reorder a linked list: Even-length chainCompany MediumPremium
  8. #288Reorder a linked list: Odd-length chainCompany MediumPremium
  9. #289Implement an LRU cache: Evict old entriesCompany HardPremium
  10. #290Implement an LRU cache: Refresh an existing keyCompany HardPremium
  11. #291Implement a minimum stack: Track changing minimumsCompany MediumPremium
  12. #292Implement a minimum stack: Duplicate minimumCompany MediumPremium
  13. #293Find warmer-day waits: Mixed forecastCompany MediumPremium
  14. #294Find warmer-day waits: Never warmerCompany MediumPremium
  15. #295Find the largest histogram rectangle: Classic histogramCompany HardPremium
  16. #296Find the largest histogram rectangle: Uniform barsCompany HardPremium
  17. #297Find sliding-window maximums: Overlapping windowsCompany HardPremium
  18. #298Find sliding-window maximums: Window of oneCompany HardPremium
  19. #299Count required meeting rooms: Overlapping meetingsCompany MediumPremium
  20. #300Count required meeting rooms: Back-to-back meetingsCompany MediumPremium
16

Top Company Trees and Tries

Cover the binary-tree, BST, trie, traversal, serialization, and path questions seen in coding loops.

  1. #301Find lowest common ancestor: Targets in different subtreesCompany MediumPremium
  2. #302Find lowest common ancestor: One node is an ancestorCompany MediumPremium
  3. #303Find kth smallest value in a BST: Third smallestCompany MediumPremium
  4. #304Find kth smallest value in a BST: Smallest valueCompany MediumPremium
  5. #305Serialize and deserialize a binary tree: Sparse tree round tripCompany HardPremium
  6. #306Serialize and deserialize a binary tree: Trim redundant trailing nullsCompany HardPremium
  7. #307Build a tree from preorder and inorder: Balanced reconstructionCompany MediumPremium
  8. #308Build a tree from preorder and inorder: Right-skewed reconstructionCompany MediumPremium
  9. #309View a binary tree from the right: Sparse right viewCompany MediumPremium
  10. #310View a binary tree from the right: Left-only treeCompany MediumPremium
  11. #311Calculate binary-tree diameter: Diameter crosses rootCompany MediumPremium
  12. #312Calculate binary-tree diameter: Skewed treeCompany MediumPremium
  13. #313List root-to-leaf target paths: Two valid pathsCompany MediumPremium
  14. #314List root-to-leaf target paths: No target pathCompany MediumPremium
  15. #315Implement a prefix trie: Word and prefix checksCompany MediumPremium
  16. #316Implement a prefix trie: Missing prefixCompany MediumPremium
  17. #317Find dictionary words in a board: Several board wordsCompany HardPremium
  18. #318Find dictionary words in a board: No word can be formedCompany HardPremium
  19. #319Find maximum binary-tree path sum: Best path crosses a subtree rootCompany HardPremium
  20. #320Find maximum binary-tree path sum: All negative valuesCompany HardPremium
17

Top Company Graphs and Union-Find

Solve connectivity, dependency, weighted-path, and ordering problems with graph algorithms.

  1. #321Count connected components with union-find: Two graph componentsCompany MediumPremium
  2. #322Count connected components with union-find: No edgesCompany MediumPremium
  3. #323Find a redundant graph edge: Triangle cycleCompany MediumPremium
  4. #324Find a redundant graph edge: Longer cycleCompany MediumPremium
  5. #325Check if courses can be completed: Acyclic prerequisitesCompany MediumPremium
  6. #326Check if courses can be completed: Circular prerequisitesCompany MediumPremium
  7. #327Clone an undirected graph: Connected graph cloneCompany MediumPremium
  8. #328Clone an undirected graph: Include isolated nodeCompany MediumPremium
  9. #329Merge accounts by shared email: Shared email mergeCompany MediumPremium
  10. #330Merge accounts by shared email: No shared emailsCompany MediumPremium
  11. #331Find a word-ladder length: Reachable transformationCompany HardPremium
  12. #332Find a word-ladder length: Missing destinationCompany HardPremium
  13. #333Evaluate division queries: Connected ratiosCompany MediumPremium
  14. #334Evaluate division queries: Disconnected variablesCompany MediumPremium
  15. #335Find network delay time: All nodes reachedCompany MediumPremium
  16. #336Find network delay time: Unreachable nodeCompany MediumPremium
  17. #337Find cheapest flight with stop limit: Cheaper one-stop routeCompany MediumPremium
  18. #338Find cheapest flight with stop limit: Stop limit blocks routeCompany MediumPremium
  19. #339Infer an alien alphabet: Valid alien orderCompany HardPremium
  20. #340Infer an alien alphabet: Invalid prefix orderCompany HardPremium
18

Top Company Greedy, DP, Backtracking, and Bit Problems

Finish the company set with greedy proofs, dynamic programming, backtracking, grids, and bit logic.

  1. #341Decide if the last array index is reachable: Reachable final indexCompany MediumPremium
  2. #342Decide if the last array index is reachable: Blocked by zeroCompany MediumPremium
  3. #343Find a valid gas-station start: One valid starting stationCompany MediumPremium
  4. #344Find a valid gas-station start: Impossible circuitCompany MediumPremium
  5. #345Partition values into equal sums: Equal partition existsCompany MediumPremium
  6. #346Partition values into equal sums: Equal partition impossibleCompany MediumPremium
  7. #347Segment a string into dictionary words: Segmentable textCompany MediumPremium
  8. #348Segment a string into dictionary words: Near match failsCompany MediumPremium
  9. #349Count numeric message decodings: Several decodingsCompany MediumPremium
  10. #350Count numeric message decodings: Leading zeroCompany MediumPremium
  11. #351Count unique paths with obstacles: One central obstacleCompany MediumPremium
  12. #352Count unique paths with obstacles: Start blockedCompany MediumPremium
  13. #353Generate target-sum combinations: Two combination familiesCompany MediumPremium
  14. #354Generate target-sum combinations: No combinationCompany MediumPremium
  15. #355Search a word in a character board: Word existsCompany MediumPremium
  16. #356Search a word in a character board: Reuse would be requiredCompany MediumPremium
  17. #357Validate a Sudoku board: Valid partial boardCompany MediumPremium
  18. #358Validate a Sudoku board: Invalid duplicateCompany MediumPremium
  19. #359Find the single value with XOR: Unpaired positive valueCompany MediumPremium
  20. #360Find the single value with XOR: Negative single valueCompany MediumPremium