Minimum Remove to Make Valid Parentheses — Stack Solution
Solve LeetCode 1249 Minimum Remove to Make Valid Parentheses using a stack. Two-pass and one-pass approaches with Python code and traces.
28 posts · page 1 of 1
Solve LeetCode 1249 Minimum Remove to Make Valid Parentheses using a stack. Two-pass and one-pass approaches with Python code and traces.
Solve Simplify Path LeetCode 71 with a stack. Handle ., .., multiple slashes, and edge cases. Python solution with step-by-step trace.
Tag Validator solved with stack-based HTML/XML tag matching and CDATA parsing. Python solution with edge cases, step-by-step trace, and complexity analysis.
Master anagram problems — valid anagram checks, grouping anagrams by sorted and frequency keys, finding all anagrams in a string with sliding windows, and the minimum window substring problem.
Master string encoding and decoding — delimiter-based encode/decode, run-length encoding, decoding nested bracket strings with stacks, string compression, and serialization patterns.
Master string hashing for pattern matching — polynomial hashing, rolling hash for Rabin-Karp, double hashing, repeated DNA sequences, and longest duplicate substring.
A complete guide to string interview patterns — top 20 patterns, two-pointer on strings, frequency map technique, sliding window template, when to use Trie vs HashMap, common mistakes, and a complexity cheatsheet.
Sliding window on strings with reusable templates — longest substring without repeating, minimum window substring, K distinct characters, and permutation check.
Essential string manipulation tricks — reverse words, reverse vowels, string rotation check, repeated substring pattern, multiply strings, and add binary.
Master palindrome problems — longest palindromic substring with expand-around-center and Manacher's algorithm, counting palindromic substrings, and palindrome partitioning.
Master parentheses problems — validate with stacks, generate all combinations with backtracking, find the longest valid substring with DP and stack, remove invalid parentheses with BFS, and more.
Master string subsequence problems — check subsequences with two pointers, count distinct subsequences with DP, find the longest common subsequence, and build the shortest common supersequence.
Advanced Trie applications — autocomplete system, search suggestions, word break with Trie, longest word in dictionary, replace words, and magic dictionary.
Learn the Rabin-Karp algorithm for string matching using rolling hash. Covers polynomial hashing, collision avoidance, multiple pattern matching, and comparison with KMP.
Learn suffix arrays from scratch -- naive and O(n log^2 n) construction, LCP arrays, pattern searching with binary search, and applications like longest repeated substring.
Master the Z-algorithm for pattern matching in O(n) time. Learn Z-array construction, the Z-box optimization, and applications like finding string periods and distinct substrings.
Master advanced string algorithms — Z-algorithm, Rabin-Karp rolling hash, suffix arrays, Aho-Corasick multi-pattern matching, Manacher's palindrome algorithm, and string hashing techniques.
Master the Knuth-Morris-Pratt algorithm — build the failure function, avoid redundant comparisons, and solve pattern matching problems in O(n + m) time.
Learn how std::string_view gives you cheap, non-owning views into strings — when to use it, how it speeds up code, and how to avoid dangling references.
A practical tour of the Pandas .str accessor: cleaning text, extracting patterns, splitting and joining, dealing with missing values, and writing string code that stays fast.
A complete guide to Python f-strings — basic interpolation, format specifiers for numbers and dates, alignment and padding, debug syntax, and when to choose other formatting methods.
Edit Distance fully unpacked — the three-operation recurrence, the 2D table, and the rolling-array space optimization that makes interviewers nod.
Walk through the Longest Palindromic Substring problem using the expand-around-center technique. Compare brute force, DP, and the optimal approach with examples.
An introduction to strings for data structures and algorithms — immutability, indexing, slicing, common operations, ASCII versus Unicode, and the two-pointer and frequency-counter patterns you will use everywhere.
A practical tour of substring search — the naive O(n·m) scan, the KMP algorithm with its LPS array, and the Rabin-Karp rolling hash. Worked examples, code, and intuition for when to use each.
Eight classic string problems with worked Python solutions — Valid Anagram, Group Anagrams, Longest Substring Without Repeating Characters, Longest Palindromic Substring, and more.
A practical guide to JavaScript strings — template literals, indexing, the essential methods, immutability, and the modern ways to slice, search, and transform text.
A thorough introduction to Python strings — creation, escape sequences, indexing, slicing, the essential methods, f-strings, and why strings are immutable.