What is the pattern used in the Two Sum problem?
HashMap to store complements
Key line: if (target - num) in seen: return [seen[target-num], i]
What data structure is used in the Valid Parentheses problem?
Stack for matching pairs
Key insight: Push opening brackets, pop and verify closing brackets match
What is the key insight for the Best Time to Buy and Sell Stock problem?
Track minimum price so far, calculate profit at each point
Key lines: min_price = min(min_price, price); max_profit = max(max_profit, price - min_price)
What algorithm is used in the Maximum Subarray problem?
Kadane’s algorithm
Key insight: Current sum = max(current number, current sum + current number)
What is the pattern used in the Longest Substring Without Repeating problem?
Sliding window with set
Key insight: Expand right, shrink left when duplicate found
What is the key line for the Merge Intervals problem?
if current[0] <= last[1]: merge
Pattern: Sort by start, merge overlapping
What is the pattern used in the Product of Array Except Self problem?
Prefix and suffix products
Key insight: Result[i] = prefix[i-1] * suffix[i+1]
What data structure is used in the Group Anagrams problem?
HashMap with sorted string as key
Key line: key = ““.join(sorted(word))
What is the pattern used in the Binary Tree Level Order Traversal problem?
BFS with queue
Key insight: Process all nodes at current level before moving to next
What is the key insight for the Climbing Stairs problem?
Dynamic programming (like Fibonacci)
Key insight: ways[i] = ways[i-1] + ways[i-2]