stack

032.Longest-Valid-Parenthesesarrow-up-right (H) 155.Min-Stackarrow-up-right (M) 225.Implement Stack using Queuesarrow-up-right (H-) 232.Implement-Queue-using-Stacksarrow-up-right (H-) 341.Flatten-Nested-List-Iteratorarrow-up-right (M) 173.Binary-Search-Tree-Iteratorarrow-up-right (M) 536.Construct-Binary-Tree-from-Stringarrow-up-right (M) 456.132-Patternarrow-up-right (H-) 636.Exclusive-Time-of-Functionsarrow-up-right (H-) 856.Score-of-Parenthesesarrow-up-right (M+) 946.Validate-Stack-Sequencesarrow-up-right(H-) 1190.Reverse-Substrings-Between-Each-Pair-of-Parenthesesarrow-up-right (H-) 1209.Remove-All-Adjacent-Duplicates-in-String-IIarrow-up-right (M+) 1586.Binary-Search-Tree-Iterator-IIarrow-up-right (H)

monotonic stack

042.Trapping-Rain-Waterarrow-up-right (H) 084.Largest-Rectangle-in-Histogramarrow-up-right (H) 085.Maximal-Rectanglearrow-up-right (H-) 255.Verify-Preorder-Sequence-in-Binary-Search-Treearrow-up-right (H) 402.Remove-K-Digitsarrow-up-right (H-) 316.Remove-Duplicate-Lettersarrow-up-right (H) 496.Next-Greater-Element-Iarrow-up-right (H-) 503.Next-Greater-Element-IIarrow-up-right (H-) 221.Maximal-Squarearrow-up-right (H-) 739.Daily-Temperaturesarrow-up-right (H-) 768.Max-Chunks-To-Make-Sorted-IIarrow-up-right (H-) 901.Online-Stock-Spanarrow-up-right (H-) 907.Sum-of-Subarray-Minimumsarrow-up-right (H) 1856.Maximum-Subarray-Min-Productarrow-up-right (M+) 962.Maximum-Width-Ramparrow-up-right (H) 1019.Next-Greater-Node-In-Linked-Listarrow-up-right (M) 1063.Number-of-Valid-Subarraysarrow-up-right (M+) 1124.Longest-Well-Performing-Intervalarrow-up-right (H) 1130.Minimum-Cost-Tree-From-Leaf-Valuesarrow-up-right (H) 1673.Find-the-Most-Competitive-Subsequencearrow-up-right (M) 1944.Number-of-Visible-People-in-a-Queuearrow-up-right (H) 1950.Maximum-of-Minimum-Values-in-All=Subarraysarrow-up-right (H-) 1966.Binary-Searchable-Numbers-in-an-Unsorted-Arrayarrow-up-right (M+)

parse expression

071.Simplify-Patharrow-up-right (M) 224.Basic-Calculatorarrow-up-right(H-) 227.Basic-Calculator-IIarrow-up-right (H-) 772.Basic-Calculator-IIIarrow-up-right (H) 385.Mini-Parserarrow-up-right (H) 439.Ternary-Expression-Parserarrow-up-right (H-) 591.Tag-Validatorarrow-up-right (H) 726.Number-of-Atomsarrow-up-right (M+) 1087.Brace-Expansionarrow-up-right (H) 1096.Brace-Expansion-IIarrow-up-right (H) 1106.Parsing-A-Boolean-Expressionarrow-up-right (H-) 1896.Minimum-Cost-to-Change-the-Final-Value-of-Expressionarrow-up-right (H+)

Calculator

  • Evaluate infix expression. The problem can have various follow-ups

    • How to define input: String s or String[] tokens. If input is defined as String s and numbers might include negative numbers, then parsing negative numbers can be kind of cumbersome. When possible, define input as String[] tokens. Even when required to define input as String s, double check whether we need to deal with negative numbers.

    • Whether contain space

    • Whether need to deal with parentheses

Parentheses [TODO]

  • Check if string s contains valid parenthese

    • Questions to confirm

      • Whether the string contains non-parentheses characters

      • Whether the string contains curly braces, brackets or parentheses

      • Need to calculate the invalid number or just judge it is valid or not

Last updated