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.
Core concepts
Problem-solving patterns
- Identify a provable choice, reusable state, or constrained search space
Reported company tags
All 20 problems in this topic
Work from top to bottom to build the concept gradually.
- #341Decide if the last array index is reachable: Reachable final indexCompany MediumPremium
Determine whether some sequence of jumps reaches the last position.
- #342Decide if the last array index is reachable: Blocked by zeroCompany MediumPremium
Return False when every route is trapped before the end.
- #343Find a valid gas-station start: One valid starting stationCompany MediumPremium
Find a station from which one complete circuit is possible.
- #344Find a valid gas-station start: Impossible circuitCompany MediumPremium
Return -1 when total fuel is less than total travel cost.
- #345Partition values into equal sums: Equal partition existsCompany MediumPremium
Determine that the values can be split into two equal-sum groups.
- #346Partition values into equal sums: Equal partition impossibleCompany MediumPremium
Return False when no subset reaches half of the total.
- #347Segment a string into dictionary words: Segmentable textCompany MediumPremium
Check whether the complete string can be split into dictionary entries.
- #348Segment a string into dictionary words: Near match failsCompany MediumPremium
Reject a string whose final characters cannot be covered by the dictionary.
- #349Count numeric message decodings: Several decodingsCompany MediumPremium
Count all A-to-Z interpretations of a digit string.
- #350Count numeric message decodings: Leading zeroCompany MediumPremium
A message beginning with zero has no valid decoding.
- #351Count unique paths with obstacles: One central obstacleCompany MediumPremium
Count right-and-down routes that avoid a blocked cell.
- #352Count unique paths with obstacles: Start blockedCompany MediumPremium
Return zero when the starting cell is blocked.
- #353Generate target-sum combinations: Two combination familiesCompany MediumPremium
List every nondecreasing candidate combination that reaches the target.
- #354Generate target-sum combinations: No combinationCompany MediumPremium
Report None when the target cannot be built from the candidates.
- #355Search a word in a character board: Word existsCompany MediumPremium
Determine that adjacent cells can spell the target without reusing a cell.
- #356Search a word in a character board: Reuse would be requiredCompany MediumPremium
Return False when spelling the target would need the same board cell twice.
- #357Validate a Sudoku board: Valid partial boardCompany MediumPremium
Validate a partially filled board with no repeated constrained digits.
- #358Validate a Sudoku board: Invalid duplicateCompany MediumPremium
Detect a repeated digit inside the top-left 3-by-3 box.
- #359Find the single value with XOR: Unpaired positive valueCompany MediumPremium
Find the only value without a duplicate.
- #360Find the single value with XOR: Negative single valueCompany MediumPremium
The XOR method also works with Python's signed integers.