Stop early [mp]
Micro pattern¶
Description¶
Return or break once remaining computation cannot change the answer.
Problems¶
Stop when no work remains¶
Terminate when a pass makes no changes or carry has disappeared.
- Bubble sort (DSA)
- 66. Plus One (Top Easy)
Stop on a witness or contradiction¶
Return after establishing success, failure, or the requested rank.
- 14. Longest Common Prefix (Top Easy)
- 125. Valid Palindrome (Top Easy)
- 217. Contains Duplicate (Top Easy)
- 33. Search in Rotated Sorted Array (Top Medium)
- 55. Jump Game (Top Medium)
- 79. Word Search (Top Medium)
- 230. Kth Smallest Element in a BST (Top Medium)
- 334. Increasing Triplet Subsequence (Top Medium)
- 127. Word Ladder (Top Hard)
- 44. Wildcard Matching (Top Hard)
- 139. Word Break (Top Hard)
- 279. Perfect Squares (Top Hard)
- 1926. Nearest Exit from Entrance in Maze (Graph Theory)
- 934. Shortest Bridge (Graph Theory)
- 433. Minimum Genetic Mutation (Graph Theory)
- 1306. Jump Game III (Graph Theory)
- 1091. Shortest Path in Binary Matrix (Graph Theory)
- 864. Shortest Path to Get All Keys (Graph Theory)
- 785. Is Graph Bipartite? (Graph Theory)
- 990. Satisfiability of Equality Equations (Graph Theory)
- 1203. Sort Items by Groups Respecting Dependencies (Graph Theory)