SnowflakeSoftware Engineer · Technical ScreenCodemia practiceImplement Deque with O(n) time
Implement a deque (double-ended queue) data structure that supports the operations of adding and removing elements from both ends in O(n) time. Your implementation should include methods for pushFront, pushBack, popFront, popBack, and peek, with appropriate input and output specifications for each operation. Ensure that your solution handles edge cases, such as operations on an empty deque.
Medium
Coding & Algorithms