dsa1 min read
Course Schedule II — Topological Order via BFS
Return a valid course order using Kahn's BFS topological sort, or empty array if a cycle exists.
Read →
webcoderspeed.com
1276 articles
Return a valid course order using Kahn's BFS topological sort, or empty array if a cycle exists.
Find the shortest word transformation sequence using BFS where each step changes exactly one character.
Evaluate a string expression with +, -, *, / using a stack that handles operator precedence without parentheses.
Detect a 132 pattern (i < j < k, nums[i] < nums[k] < nums[j]) using a monotonic stack scanning right to left.
Count visible people in a queue for each person using a monotonic decreasing stack scanning right to left.