Skip to content

Latest commit

 

History

History
68 lines (37 loc) · 5.6 KB

stack-queue.md

File metadata and controls

68 lines (37 loc) · 5.6 KB

Stack & Queue LeetCode Problems

A collection of LeetCode problems solved using Stack & Queue pattern techniques, explanations, and complexity analysis.

Problems

Easy

# Problem Language Time Space Explanation
20 Valid Parentheses JavaScript O(n) O(n) Explanation

| 28 | Find the Index of the First Occurrence in a String | Python | O(n) | O(n) | Explanation |

| 746 | Min Cost Climbing Stairs | JavaScript, Python | O(n) | O(n) | Explanation |

| 1021 | Remove Outermost Parentheses | Python | O(n) | O(n) | Explanation |

| 1614 | Maximum Nesting Depth of the Parentheses | Java | O(n) | O(n) | Explanation |

| 1700 | Number of Students Unable to Eat Lunch | C++, JavaScript | O(n) | O(n) | Explanation |

| 2888 | Reshape Data: Concatenate | Python | O(n) | O(n) | Explanation |

Medium

# Problem Language Time Space Explanation
22 Generate Parentheses C++ O(n) O(n) Explanation

| 117 | Populating Next Right Pointers in Each Node II | JavaScript | O(n) | O(n) | Explanation |

| 150 | Evaluate Reverse Polish Notation | TypeScript | O(n) | O(n) | Explanation |

| 155 | Min Stack | JavaScript | O(n) | O(n) | Explanation |

| 399 | Evaluate Division | JavaScript | O(n) | O(n) | Explanation |

| 406 | Queue Reconstruction by Height | JavaScript | O(n) | O(n) | Explanation |

| 636 | Exclusive Time of Functions | TypeScript | O(n) | O(n) | Explanation |

| 856 | Score of Parentheses | Python | O(n) | O(n) | Explanation |

| 921 | Minimum Add to Make Parentheses Valid | Python | O(n) | O(n) | Explanation |

| 1111 | Maximum Nesting Depth of Two Valid Parentheses Strings | C++ | O(n) | O(n) | Explanation |

| 1190 | Reverse Substrings Between Each Pair of Parentheses | C++ | O(n) | O(n) | Explanation |

| 1441 | Build an Array With Stack Operations | TypeScript | O(n) | O(n) | Explanation |

| 1541 | Minimum Insertions to Balance a Parentheses String | Python | O(n) | O(n) | Explanation |

Hard

# Problem Language Time Space Explanation
32 Longest Valid Parentheses Python O(n) O(n) Explanation

| 301 | Remove Invalid Parentheses | Python | O(n) | O(n) | Explanation |

| 2267 | Check if There Is a Valid Parentheses String Path | C++ | O(n) | O(n) | Explanation |

| 2267 | Check if There Is a Valid Parentheses String Path | C++ | O(n) | O(n) | Explanation |

| 2897 | Apply Operations on Array to Maximize Sum of Squares | JavaScript | O(n) | O(n) | Explanation |