All Posts

Leetcode 150: Evaluate Reverse Polish Notation

You are given an array of strings tokens that represents an arithmetic expression in Reverse Polish Notation (RPN). Your task is to evaluate the expression and return the result as an integer.

Leetcode 155: Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

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 316: Remove Duplicate Letters

Given a string ’s’, remove duplicate letters so that every letter appears once and only once. The result should be the smallest lexicographical order among all possible results.

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.