dsa1 min read
Design Circular Queue — Array with Head and Tail Pointers
Implement a circular queue using a fixed-size array with head and tail pointers and a size counter.
Read →
webcoderspeed.com
1276 articles
Implement a circular queue using a fixed-size array with head and tail pointers and a size counter.
Find cells that can flow to both oceans by doing reverse BFS from each ocean's borders and finding the intersection.
Maximize score jumping through an array with window k by combining DP with a monotonic decreasing deque.
Find the shortest subarray with sum >= k using a monotonic deque on prefix sums for O(n) time.
Fill each empty room with its distance to nearest gate using simultaneous multi-source BFS from all gates.