All Posts

Leetcode 225: Implement Stack using Queues

Design a stack that supports LIFO (Last In First Out) operations using only one queue. Implement standard stack operations: push, pop, top, and empty.

Leetcode 232: Implement Queue using Stacks

Design and implement a queue using only two stacks. The queue should support the basic operations of a normal queue: enqueue, dequeue, peek, and checking if the queue is empty.

Leetcode 341: Flatten Nested List Iterator

You are given a nested list of integers nestedList, where each element can either be an integer or a sublist containing integers or other sublists. Implement an iterator to flatten this nested list.

Leetcode 387: First Unique Character in a String

Given a string s, find the index of the first character that does not repeat in the string. If all characters repeat, return -1.

Leetcode 622: Design Circular Queue

Design and implement a Circular Queue. A circular queue is a linear data structure where the operations follow the FIFO principle, and the last position is connected to the first, forming a circle. This design allows better space utilization.

Leetcode 641: Design Circular Deque

Design a data structure that simulates a circular double-ended queue (deque) with a fixed maximum size. Implement the MyCircularDeque class with methods for inserting, deleting, and accessing elements at both ends of the deque.