bujidao

# Getting Started

# Algorithms

LeetCode Hot 100 Overview

Plan your LeetCode Hot 100 journey by grouping problems by data structure and difficulty.

LeetCode Hot 100: 020 - Valid Parentheses

Use a stack (ArrayDeque) plus a map to validate a parentheses string, and see why Deque is preferred over the legacy Stack.

LeetCode Hot 100: 155 - Min Stack

Design a stack that supports push, pop, top operations, and can retrieve the minimum element in constant time, using dual stacks (data stack + auxiliary stack).

LeetCode Hot 100: 347 - Top K Frequent Elements

Count with a hash map, then keep only k candidates in a min-heap for O(n log k) time.

LeetCode Hot 100: 394 - Decode String

Parse k[encoded_string] encoding rules using dual stacks to store repetition counts and string context, supporting nested brackets and decoding in O(n) time.

LeetCode Hot 100: 739 - Daily Temperatures

Use a monotonic stack (storing indices) to find the number of days until a warmer temperature in one linear scan.

LeetCode Hot 100: 084 - Largest Rectangle in Histogram

Use a monotonic increasing stack (storing indices) with a sentinel trick to find the maximum rectangle area with each bar as the minimum height in one pass.

295 - Find Median from Data Stream

Classic two-heap approach: max-heap for the lower half, min-heap for the upper half; support online median queries.

LeetCode Hot 100: 121 - Best Time to Buy and Sell Stock

Greedy scan: track the minimum price so far, and update the best profit if selling today is better.

LeetCode Hot 100: 055 - Jump Game

Greedy approach: maintain the farthest reachable position from the start, and check if we can reach the last index.

215 - Kth Largest Element in an Array

Use Quickselect (randomized partition) to find the k-th largest element in expected O(n) time.

# Interview