LeetCode 150: Evaluate Reverse Polish Notation
Evaluate an arithmetic expression written in Reverse Polish Notation using a stack.
17 notes
Evaluate an arithmetic expression written in Reverse Polish Notation using a stack.
Design an LRU cache with O(1) get and put operations using a hash map and doubly linked list.
Find the node where a linked list cycle begins using Floyd’s tortoise and hare algorithm with cycle entry mathematics.
Create a deep copy of a linked list with next and random pointers using hash maps or interleaved node cloning.
Find the number that appears once when every other number appears three times using bit counting or finite-state bit manipulation.
A clear explanation of finding the bitwise AND of every number in an inclusive range using the common binary prefix.
Sort a singly linked list in ascending order using merge sort with fast and slow pointers.
Sort a singly linked list using insertion sort by splicing each node into a growing sorted list.
Reorder a singly linked list in-place by finding the middle, reversing the second half, and merging the two halves alternately.
Decide whether a string can be segmented into dictionary words using dynamic programming over prefixes.
Find the unique starting gas station index using a greedy scan with total fuel balance and current tank balance.
Create a deep copy of a connected undirected graph using DFS and a hash map from original nodes to cloned nodes.
Generate all ways to split a string so that every piece is a palindrome, using backtracking with palindrome precomputation.
Capture surrounded O regions by marking border-connected O cells first, then flipping the remaining O cells.
Compute the sum of all numbers formed by root-to-leaf paths using depth-first search and decimal accumulation.
Find the longest run of consecutive integers in an unsorted array using a hash set and sequence-start detection.
Use breadth-first search to find the shortest transformation sequence length between two words.