Positional comparison [mp]
Micro pattern¶
Description¶
Compare values at related structural positions rather than searching globally for equal values.
Problems¶
Same index across sequences¶
Compare corresponding entries and act on their agreement or first difference.
- 14. Longest Common Prefix (Top Easy)
- 839. Similar String Groups (Graph Theory)
Mirrored positions¶
Compare opposite sides of a tree, list, or substring.
- 101. Symmetric Tree (Top Easy)
- 234. Palindrome Linked List (Top Easy)
- 5. Longest Palindromic Substring (Top Medium)
- 516. Longest Palindromic Subsequence (Dynamic Programming)
- 1312. Minimum Insertion Steps to Make a String Palindrome (Dynamic Programming)
Adjacent symbols¶
Compare a symbol with its successor when their relationship determines its contribution.
- 13. Roman to Integer (Top Easy)