pyPython Practice LabFrom first print to final round
TOPIC 18 OF 18

Top Company Greedy, DP, Backtracking, and Bit Problems Python practice problems

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

20 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL PRACTISE

Core concepts

Decide if the last array index is reachableFind a valid gas-station startPartition values into equal sumsSegment a string into dictionary wordsCount numeric message decodingsCount unique paths with obstaclesGenerate target-sum combinationsSearch a word in a character board
REUSABLE THINKING

Problem-solving patterns

  • Identify a provable choice, reusable state, or constrained search space
INTERVIEW SIGNALS

Reported company tags

AmazonGoogleMetaMicrosoft
Community-reported tags are guidance, not guarantees.
ORDERED PRACTICE

All 20 problems in this topic

Work from top to bottom to build the concept gradually.

  1. #341
    Decide if the last array index is reachable: Reachable final index

    Determine whether some sequence of jumps reaches the last position.

    Company MediumPremium
  2. #342
    Decide if the last array index is reachable: Blocked by zero

    Return False when every route is trapped before the end.

    Company MediumPremium
  3. #343
    Find a valid gas-station start: One valid starting station

    Find a station from which one complete circuit is possible.

    Company MediumPremium
  4. #344
    Find a valid gas-station start: Impossible circuit

    Return -1 when total fuel is less than total travel cost.

    Company MediumPremium
  5. #345
    Partition values into equal sums: Equal partition exists

    Determine that the values can be split into two equal-sum groups.

    Company MediumPremium
  6. #346
    Partition values into equal sums: Equal partition impossible

    Return False when no subset reaches half of the total.

    Company MediumPremium
  7. #347
    Segment a string into dictionary words: Segmentable text

    Check whether the complete string can be split into dictionary entries.

    Company MediumPremium
  8. #348
    Segment a string into dictionary words: Near match fails

    Reject a string whose final characters cannot be covered by the dictionary.

    Company MediumPremium
  9. #349
    Count numeric message decodings: Several decodings

    Count all A-to-Z interpretations of a digit string.

    Company MediumPremium
  10. #350
    Count numeric message decodings: Leading zero

    A message beginning with zero has no valid decoding.

    Company MediumPremium
  11. #351
    Count unique paths with obstacles: One central obstacle

    Count right-and-down routes that avoid a blocked cell.

    Company MediumPremium
  12. #352
    Count unique paths with obstacles: Start blocked

    Return zero when the starting cell is blocked.

    Company MediumPremium
  13. #353
    Generate target-sum combinations: Two combination families

    List every nondecreasing candidate combination that reaches the target.

    Company MediumPremium
  14. #354
    Generate target-sum combinations: No combination

    Report None when the target cannot be built from the candidates.

    Company MediumPremium
  15. #355
    Search a word in a character board: Word exists

    Determine that adjacent cells can spell the target without reusing a cell.

    Company MediumPremium
  16. #356
    Search a word in a character board: Reuse would be required

    Return False when spelling the target would need the same board cell twice.

    Company MediumPremium
  17. #357
    Validate a Sudoku board: Valid partial board

    Validate a partially filled board with no repeated constrained digits.

    Company MediumPremium
  18. #358
    Validate a Sudoku board: Invalid duplicate

    Detect a repeated digit inside the top-left 3-by-3 box.

    Company MediumPremium
  19. #359
    Find the single value with XOR: Unpaired positive value

    Find the only value without a duplicate.

    Company MediumPremium
  20. #360
    Find the single value with XOR: Negative single value

    The XOR method also works with Python's signed integers.

    Company MediumPremium