Stack & Queue
Heap (Priority Queue)¶
- 3510. Minimum Pair Removal to Sort Array II
- 3507. Minimum Pair Removal to Sort Array I
- 3506. Find Time Required to Eliminate Bacterial Strains
- 3505. Minimum Operations to Make Elements Within K Subarrays Equal
- 3478. Choose K Elements With Maximum Sum
- 3476. Maximize Profit from Task Assignment
- 3462. Maximum Sum With at Most K Elements
- 3422. Minimum Operations to Make Subarray Elements Equal
- 3408. Design Task Manager
- 3391. Design a 3D Binary Matrix with Efficient Layer Tracking
- 3377. Digit Operations to Make Two Integers Equal
- 3369. Design an Array Statistics Tracker
- 3362. Zero Array Transformation III
- 3342. Find Minimum Time to Reach Last Room II
- 3341. Find Minimum Time to Reach Last Room I
- 3321. Find X-Sum of All K-Long Subarrays II
- 3318. Find X-Sum of All K-Long Subarrays I
- 3296. Minimum Number of Seconds to Make Mountain Height Zero
- 3286. Find a Safe Walk Through a Grid
- 3275. K-th Nearest Obstacle Queries
- 3266. Final Array State After K Multiplication Operations II
- 3264. Final Array State After K Multiplication Operations I
- 3170. Lexicographically Minimum String After Removing Stars
- 3123. Find Edges in Shortest Paths
- 3112. Minimum Time to Visit Disappearing Nodes
- 3092. Most Frequent IDs
- 3081. Replace Question Marks in String to Minimize Its Value
- 3080. Mark Elements on Array by Performing Queries
- 3066. Minimum Operations to Exceed Threshold Value II
- 3049. Earliest Second to Mark Indices II
- 3013. Divide an Array Into Subarrays With Minimum Cost II
- 2974. Minimum Number Game
- 2973. Find Number of Coins to Place in Tree Nodes
- 2969. Minimum Number of Coins for Fruits II
- 2959. Number of Possible Sets of Closing Branches
- 2944. Minimum Number of Coins for Fruits
- 2940. Find Building Where Alice and Bob Can Meet
- 2931. Maximum Spending After Buying Items
- 2813. Maximum Elegance of a K-Length Subsequence
- 2812. Find the Safest Path in a Grid
- 2762. Continuous Subarrays
- 2737. Find the Closest Marked Node
- 2714. Find Shortest Path with K Hops
- 2699. Modify Graph Edge Weights
- 2679. Sum in a Matrix
- 2662. Minimum Cost of a Path With Special Roads
- 2642. Design Graph With Shortest Path Calculator
- 2617. Minimum Number of Visited Cells in a Grid
- 2611. Mice and Cheese
- 2599. Make the Prefix Sum Non-negative
- 2593. Find Score of an Array After Marking All Elements
- 2577. Minimum Time to Visit a Cell In a Grid
- 2558. Take Gifts From the Richest Pile
- 2551. Put Marbles in Bags
- 2542. Maximum Subsequence Score
- 2532. Time to Cross a Bridge
- 2530. Maximal Score After Applying K Operations
- 2512. Reward Top K Students
- 2503. Maximum Number of Points From Grid Queries
- 2500. Delete Greatest Value in Each Row
- 2497. Maximum Star Sum of a Graph
- 2473. Minimum Cost to Buy Apples
- 2462. Total Cost to Hire K Workers
- 2456. Most Popular Video Creator
- 2454. Next Greater Element IV
- 2424. Longest Uploaded Prefix
- 2406. Divide Intervals Into Minimum Number of Groups
- 2402. Meeting Rooms III
- 2398. Maximum Number of Robots Within Budget
- 2386. Find the K-Sum of an Array
- 2357. Make Array Zero by Subtracting Equal Amounts
- 2353. Design a Food Rating System
- 2349. Design a Number Container System
- 2344. Minimum Deletions to Make Array Divisible
- 2343. Query Kth Smallest Trimmed Number
- 2342. Max Sum of a Pair With Equal Sum of Digits
- 2336. Smallest Number in Infinite Set
- 2335. Minimum Amount of Time to Fill Cups
- 2333. Minimum Sum of Squared Difference
- 2290. Minimum Obstacle Removal to Reach Corner
- 2285. Maximum Total Importance of Roads
- 2233. Maximum Product After K Increments
- 2231. Largest Number After Digit Swaps by Parity
- 2208. Minimum Operations to Halve Array Sum
- 2182. Construct String With Repeat Limit
- 2163. Minimum Difference in Sums After Removal of Elements
- 2146. K Highest Ranked Items Within a Price Range
- 2102. Sequentially Ordinal Rank Tracker
- 2099. Find Subsequence of Length K With the Largest Sum
- 2093. Minimum Cost to Reach City With Discounts
- 2054. Two Best Non-Overlapping Events
- 2034. Stock Price Fluctuation
- 2015. Average Height of Buildings in Each Segment
- 1985. Find the Kth Largest Integer in the Array
- 1962. Remove Stones to Minimize the Total
- 1942. The Number of the Smallest Unoccupied Chair
- 1912. Design Movie Rental System
- 1882. Process Tasks Using Servers
- 1878. Get Biggest Three Rhombus Sums in a Grid
- 1851. Minimum Interval to Include Each Query
- 1845. Seat Reservation Manager
- 1834. Single-Threaded CPU
- 1825. Finding MK Average
- 1810. Minimum Path Cost in a Hidden Grid
- 1801. Number of Orders in the Backlog
- 1792. Maximum Average Pass Ratio
- 1786. Number of Restricted Paths From First to Last Node
- 1776. Car Fleet II
- 1753. Maximum Score From Removing Stones
- 1738. Find Kth Largest XOR Coordinate Value
- 1705. Maximum Number of Eaten Apples
- 1696. Jump Game VI
- 1687. Delivering Boxes from Storage to Ports
- 1686. Stone Game VI
- 1675. Minimize Deviation in Array
- 1648. Sell Diminishing-Valued Colored Balls
- 1642. Furthest Building You Can Reach
- 1631. Path With Minimum Effort
- 1606. Find Servers That Handled Most Number of Requests
- 1514. Path with Maximum Probability
- 1500. Design a File Sharing System
- 1499. Max Value of Equation
- 1488. Avoid Flood in The City
- 1464. Maximum Product of Two Elements in an Array
- 1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows
- 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
- 1425. Constrained Subsequence Sum
- 1424. Diagonal Traverse II
- 1405. Longest Happy String
- 1388. Pizza With 3n Slices
- 1383. Maximum Performance of a Team
- 1368. Minimum Cost to Make at Least One Valid Path in a Grid
- 1354. Construct Target Array With Multiple Sums
- 1353. Maximum Number of Events That Can Be Attended
- 1338. Reduce Array Size to The Half
- 1337. The K Weakest Rows in a Matrix
- 1268. Search Suggestions System
- 1263. Minimum Moves to Move a Box to Their Target Location
- 1199. Minimum Time to Build Blocks
- 1183. Maximum Number of Ones
- 1172. Dinner Plate Stacks
- 1168. Optimize Water Distribution in a Village
- 1167. Minimum Cost to Connect Sticks
- 1135. Connecting Cities With Minimum Cost
- 1102. Path With Maximum Minimum Value
- 1094. Car Pooling
- 1086. High Five
- 1057. Campus Bikes
- 1054. Distant Barcodes
- 1046. Last Stone Weight
- 973. K Closest Points to Origin
- 912. Sort an Array
- 882. Reachable Nodes In Subdivided Graph
- 871. Minimum Number of Refueling Stops
- 862. Shortest Subarray with Sum at Least K
- 857. Minimum Cost to Hire K Workers
- 855. Exam Room
- 787. Cheapest Flights Within K Stops
- 786. K-th Smallest Prime Fraction
- 778. Swim in Rising Water
- 767. Reorganize String
- 759. Employee Free Time
- 743. Network Delay Time
- 703. Kth Largest Element in a Stream
- 692. Top K Frequent Words
- 683. K Empty Slots
- 675. Cut Off Trees for Golf Event
- 659. Split Array into Consecutive Subsequences
- 658. Find K Closest Elements
- 642. Design Search Autocomplete System
- 632. Smallest Range Covering Elements from K Lists
- 630. Course Schedule III
- 621. Task Scheduler
- 506. Relative Ranks
- 505. The Maze II
- 502. IPO
- 499. The Maze III
- 480. Sliding Window Median
- 451. Sort Characters By Frequency
- 420. Strong Password Checker
- 407. Trapping Rain Water II
- 378. Kth Smallest Element in a Sorted Matrix
- 373. Find K Pairs with Smallest Sums
- 358. Rearrange String k Distance Apart
- 355. Design Twitter
- 347. Top K Frequent Elements
- 295. Find Median from Data Stream
- 272. Closest Binary Search Tree Value II
- 264. Ugly Number II
- 253. Meeting Rooms II
- 239. Sliding Window Maximum
- 218. The Skyline Problem
- 215. Kth Largest Element in an Array
- 23. Merge k Sorted Lists
Monotonic Queue¶
- 3420. Count Non-Decreasing Subarrays After K Operations
- 2969. Minimum Number of Coins for Fruits II
- 2945. Find Maximum Non-decreasing Array Length
- 2944. Minimum Number of Coins for Fruits
- 2762. Continuous Subarrays
- 2444. Count Subarrays With Fixed Bounds
- 2407. Longest Increasing Subsequence II
- 2398. Maximum Number of Robots Within Budget
- 2071. Maximum Number of Tasks You Can Assign
- 1696. Jump Game VI
- 1687. Delivering Boxes from Storage to Ports
- 1499. Max Value of Equation
- 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
- 1425. Constrained Subsequence Sum
- 918. Maximum Sum Circular Subarray
- 862. Shortest Subarray with Sum at Least K
- 683. K Empty Slots
- 239. Sliding Window Maximum
Monotonic Stack¶
- 3430. Maximum and Minimum Sums of at Most Size K Subarrays
- 3420. Count Non-Decreasing Subarrays After K Operations
- 3359. Find Sorted Submatrices With Maximum Element at Most K
- 3229. Minimum Operations to Make Array Equal to Target
- 3221. Maximum Array Hopping Score II
- 3205. Maximum Array Hopping Score I
- 3113. Find the Number of Subarrays Where Boundary Elements Are Maximum
- 2945. Find Maximum Non-decreasing Array Length
- 2940. Find Building Where Alice and Bob Can Meet
- 2866. Beautiful Towers II
- 2865. Beautiful Towers I
- 2863. Maximum Length of Semi-Decreasing Subarrays
- 2832. Maximal Range That Each Element Is Maximum in It
- 2818. Apply Operations to Maximize Score
- 2736. Maximum Sum Queries
- 2617. Minimum Number of Visited Cells in a Grid
- 2487. Remove Nodes From Linked List
- 2454. Next Greater Element IV
- 2355. Maximum Number of Books You Can Take
- 2345. Finding the Number of Visible Mountains
- 2334. Subarray With Elements Greater Than Varying Threshold
- 2297. Jump Game VIII
- 2289. Steps to Make Array Non-decreasing
- 2282. Number of People That Can Be Seen in a Grid
- 2281. Sum of Total Strength of Wizards
- 2104. Sum of Subarray Ranges
- 2030. Smallest K-Length Subsequence With Occurrences of a Letter
- 1996. The Number of Weak Characters in the Game
- 1950. Maximum of Minimum Values in All Subarrays
- 1944. Number of Visible People in a Queue
- 1856. Maximum Subarray Min-Product
- 1793. Maximum Score of a Good Subarray
- 1776. Car Fleet II
- 1762. Buildings With an Ocean View
- 1673. Find the Most Competitive Subsequence
- 1574. Shortest Subarray to be Removed to Make Array Sorted
- 1526. Minimum Number of Increments on Subarrays to Form a Target Array
- 1504. Count Submatrices With All Ones
- 1475. Final Prices With a Special Discount in a Shop
- 1130. Minimum Cost Tree From Leaf Values
- 1124. Longest Well-Performing Interval
- 1081. Smallest Subsequence of Distinct Characters
- 1063. Number of Valid Subarrays
- 1019. Next Greater Node In Linked List
- 1008. Construct Binary Search Tree from Preorder Traversal
- 975. Odd Even Jump
- 962. Maximum Width Ramp
- 907. Sum of Subarray Minimums
- 901. Online Stock Span
- 853. Car Fleet
- 769. Max Chunks To Make Sorted
- 768. Max Chunks To Make Sorted II
- 739. Daily Temperatures
- 654. Maximum Binary Tree
- 581. Shortest Unsorted Continuous Subarray
- 503. Next Greater Element II
- 496. Next Greater Element I
- 456. 132 Pattern
- 402. Remove K Digits
- 321. Create Maximum Number
- 316. Remove Duplicate Letters
- 255. Verify Preorder Sequence in Binary Search Tree
- 85. Maximal Rectangle
- 84. Largest Rectangle in Histogram
- 42. Trapping Rain Water
Queue¶
- 3508. Implement Router
- 3420. Count Non-Decreasing Subarrays After K Operations
- 3369. Design an Array Statistics Tracker
- 3191. Minimum Operations to Make Binary Array Elements Equal to One I
- 3117. Minimum Sum of Values by Dividing Array
- 2969. Minimum Number of Coins for Fruits II
- 2945. Find Maximum Non-decreasing Array Length
- 2944. Minimum Number of Coins for Fruits
- 2762. Continuous Subarrays
- 2534. Time Taken to Cross the Door
- 2528. Maximize the Minimum Powered City
- 2526. Find Consecutive Integers from a Data Stream
- 2444. Count Subarrays With Fixed Bounds
- 2407. Longest Increasing Subsequence II
- 2398. Maximum Number of Robots Within Budget
- 2327. Number of People Aware of a Secret
- 2073. Time Needed to Buy Tickets
- 2071. Maximum Number of Tasks You Can Assign
- 1825. Finding MK Average
- 1823. Find the Winner of the Circular Game
- 1700. Number of Students Unable to Eat Lunch
- 1696. Jump Game VI
- 1687. Delivering Boxes from Storage to Ports
- 1670. Design Front Middle Back Queue
- 1499. Max Value of Equation
- 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
- 1429. First Unique Number
- 1425. Constrained Subsequence Sum
- 995. Minimum Number of K Consecutive Bit Flips
- 950. Reveal Cards In Increasing Order
- 936. Stamping The Sequence
- 933. Number of Recent Calls
- 918. Maximum Sum Circular Subarray
- 862. Shortest Subarray with Sum at Least K
- 683. K Empty Slots
- 649. Dota2 Senate
- 641. Design Circular Deque
- 622. Design Circular Queue
- 387. First Unique Character in a String
- 379. Design Phone Directory
- 362. Design Hit Counter
- 353. Design Snake Game
- 346. Moving Average from Data Stream
- 341. Flatten Nested List Iterator
- 281. Zigzag Iterator
- 239. Sliding Window Maximum
- 232. Implement Queue using Stacks
- 225. Implement Stack using Queues
Stack¶
- 3430. Maximum and Minimum Sums of at Most Size K Subarrays
- 3420. Count Non-Decreasing Subarrays After K Operations
- 3412. Find Mirror Score of a String
- 3359. Find Sorted Submatrices With Maximum Element at Most K
- 3229. Minimum Operations to Make Array Equal to Target
- 3221. Maximum Array Hopping Score II
- 3205. Maximum Array Hopping Score I
- 3174. Clear Digits
- 3170. Lexicographically Minimum String After Removing Stars
- 3113. Find the Number of Subarrays Where Boundary Elements Are Maximum
- 2945. Find Maximum Non-decreasing Array Length
- 2940. Find Building Where Alice and Bob Can Meet
- 2866. Beautiful Towers II
- 2865. Beautiful Towers I
- 2863. Maximum Length of Semi-Decreasing Subarrays
- 2832. Maximal Range That Each Element Is Maximum in It
- 2818. Apply Operations to Maximize Score
- 2816. Double a Number Represented as a Linked List
- 2813. Maximum Elegance of a K-Length Subsequence
- 2764. Is Array a Preorder of Some ‌Binary Tree
- 2751. Robot Collisions
- 2736. Maximum Sum Queries
- 2696. Minimum String Length After Removing Substrings
- 2645. Minimum Additions to Make Valid String
- 2617. Minimum Number of Visited Cells in a Grid
- 2589. Minimum Time to Complete All Tasks
- 2524. Maximum Frequency Score of a Subarray
- 2487. Remove Nodes From Linked List
- 2454. Next Greater Element IV
- 2434. Using a Robot to Print the Lexicographically Smallest String
- 2390. Removing Stars From a String
- 2375. Construct Smallest Number From DI String
- 2355. Maximum Number of Books You Can Take
- 2345. Finding the Number of Visible Mountains
- 2334. Subarray With Elements Greater Than Varying Threshold
- 2297. Jump Game VIII
- 2296. Design a Text Editor
- 2289. Steps to Make Array Non-decreasing
- 2282. Number of People That Can Be Seen in a Grid
- 2281. Sum of Total Strength of Wizards
- 2254. Design Video Sharing Platform
- 2216. Minimum Deletions to Make Array Beautiful
- 2211. Count Collisions on a Road
- 2197. Replace Non-Coprime Numbers in Array
- 2130. Maximum Twin Sum of a Linked List
- 2116. Check if a Parentheses String Can Be Valid
- 2104. Sum of Subarray Ranges
- 2030. Smallest K-Length Subsequence With Occurrences of a Letter
- 2019. The Score of Students Solving Math Expression
- 2000. Reverse Prefix of Word
- 1996. The Number of Weak Characters in the Game
- 1963. Minimum Number of Swaps to Make the String Balanced
- 1950. Maximum of Minimum Values in All Subarrays
- 1944. Number of Visible People in a Queue
- 1910. Remove All Occurrences of a Substring
- 1896. Minimum Cost to Change the Final Value of Expression
- 1856. Maximum Subarray Min-Product
- 1793. Maximum Score of a Good Subarray
- 1776. Car Fleet II
- 1762. Buildings With an Ocean View
- 1756. Design Most Recently Used Queue
- 1717. Maximum Score From Removing Substrings
- 1700. Number of Students Unable to Eat Lunch
- 1673. Find the Most Competitive Subsequence
- 1653. Minimum Deletions to Make String Balanced
- 1628. Design an Expression Tree With Evaluate Function
- 1614. Maximum Nesting Depth of the Parentheses
- 1598. Crawler Log Folder
- 1597. Build Binary Expression Tree From Infix Expression
- 1586. Binary Search Tree Iterator II
- 1574. Shortest Subarray to be Removed to Make Array Sorted
- 1544. Make The String Great
- 1541. Minimum Insertions to Balance a Parentheses String
- 1526. Minimum Number of Increments on Subarrays to Form a Target Array
- 1504. Count Submatrices With All Ones
- 1475. Final Prices With a Special Discount in a Shop
- 1472. Design Browser History
- 1441. Build an Array With Stack Operations
- 1381. Design a Stack With Increment Operation
- 1265. Print Immutable Linked List in Reverse
- 1249. Minimum Remove to Make Valid Parentheses
- 1214. Two Sum BSTs
- 1209. Remove All Adjacent Duplicates in String II
- 1190. Reverse Substrings Between Each Pair of Parentheses
- 1172. Dinner Plate Stacks
- 1130. Minimum Cost Tree From Leaf Values
- 1124. Longest Well-Performing Interval
- 1111. Maximum Nesting Depth of Two Valid Parentheses Strings
- 1106. Parsing A Boolean Expression
- 1096. Brace Expansion II
- 1081. Smallest Subsequence of Distinct Characters
- 1063. Number of Valid Subarrays
- 1047. Remove All Adjacent Duplicates In String
- 1021. Remove Outermost Parentheses
- 1019. Next Greater Node In Linked List
- 1008. Construct Binary Search Tree from Preorder Traversal
- 1006. Clumsy Factorial
- 1003. Check If Word Is Valid After Substitutions
- 975. Odd Even Jump
- 962. Maximum Width Ramp
- 946. Validate Stack Sequences
- 936. Stamping The Sequence
- 921. Minimum Add to Make Parentheses Valid
- 907. Sum of Subarray Minimums
- 901. Online Stock Span
- 897. Increasing Order Search Tree
- 895. Maximum Frequency Stack
- 880. Decoded String at Index
- 856. Score of Parentheses
- 853. Car Fleet
- 844. Backspace String Compare
- 772. Basic Calculator III
- 770. Basic Calculator IV
- 769. Max Chunks To Make Sorted
- 768. Max Chunks To Make Sorted II
- 739. Daily Temperatures
- 736. Parse Lisp Expression
- 735. Asteroid Collision
- 726. Number of Atoms
- 716. Max Stack
- 682. Baseball Game
- 678. Valid Parenthesis String
- 654. Maximum Binary Tree
- 636. Exclusive Time of Functions
- 591. Tag Validator
- 590. N-ary Tree Postorder Traversal
- 589. N-ary Tree Preorder Traversal
- 581. Shortest Unsorted Continuous Subarray
- 536. Construct Binary Tree from String
- 503. Next Greater Element II
- 496. Next Greater Element I
- 488. Zuma Game
- 484. Find Permutation
- 456. 132 Pattern
- 445. Add Two Numbers II
- 439. Ternary Expression Parser
- 426. Convert Binary Search Tree to Sorted Doubly Linked List
- 402. Remove K Digits
- 394. Decode String
- 388. Longest Absolute File Path
- 385. Mini Parser
- 364. Nested List Weight Sum II
- 341. Flatten Nested List Iterator
- 331. Verify Preorder Serialization of a Binary Tree
- 321. Create Maximum Number
- 316. Remove Duplicate Letters
- 272. Closest Binary Search Tree Value II
- 255. Verify Preorder Sequence in Binary Search Tree
- 234. Palindrome Linked List
- 232. Implement Queue using Stacks
- 227. Basic Calculator II
- 225. Implement Stack using Queues
- 224. Basic Calculator
- 173. Binary Search Tree Iterator
- 155. Min Stack
- 150. Evaluate Reverse Polish Notation
- 145. Binary Tree Postorder Traversal
- 144. Binary Tree Preorder Traversal
- 143. Reorder List
- 114. Flatten Binary Tree to Linked List
- 94. Binary Tree Inorder Traversal
- 85. Maximal Rectangle
- 84. Largest Rectangle in Histogram
- 71. Simplify Path
- 42. Trapping Rain Water
- 32. Longest Valid Parentheses
- 20. Valid Parentheses