Generate a Contest — random problems from the 615-bank
Preset
Topic scope — click a topic to exclude it
Contest Set 1 — Mixed Difficulty (Recommended First)
Weekly Contest Style — 4 Problems
Q1
#121 Best Time to Buy and Sell Stock Easy
Find the maximum profit from one buy and one sell. Can't sell before buying.
Track minimum price seen so far. At each position, profit = current - minSoFar. Update maxProfit.
Q2
#15 3Sum Medium
Find all unique triplets summing to zero. No duplicate triplets in result.
Sort first. Fix one element, use two pointers for remaining pair. Skip duplicates carefully at all three levels.
Q3
#300 Longest Increasing Subsequence Medium
Find length of longest strictly increasing subsequence.
O(n log n): Maintain tails array. For each num, binary search for first tail ≥ num and replace it. tails.size() = answer.
Q4
#76 Minimum Window Substring Hard
Find smallest window in s that contains all chars of t.
Variable sliding window. Expand right until all chars satisfied, then shrink left while still valid. Track have/need counts.
Contest Set 2 — Graph Focus
Graph Specialist — 4 Problems
Q1
#200 Number of Islands Medium
Count connected components of '1's in 2D grid.
DFS from each unvisited '1', mark visited cells as '0' (or use visited array). Count DFS calls.
Q2
#207 Course Schedule Medium
Determine if you can finish all courses given prerequisites (detect cycle).
Build directed graph. Kahn's BFS topo sort: if we can process all nodes (queue never stuck), no cycle → return true.
Q3
#743 Network Delay Time Medium
Minimum time for signal to reach all nodes from source k.
Classic Dijkstra. Answer = max of all shortest paths. If any node unreachable, return -1.
Q4
#127 Word Ladder Hard
Minimum transformations from beginWord to endWord, changing one letter at a time.
BFS level by level. For each word, try all 26×L neighbors. Use unordered_set for O(1) lookup and mark visited by erasing.
Contest Set 3 — DP Challenge
DP Gauntlet — 4 Problems
Q1
#198 House Robber Medium
Max rob from non-adjacent houses.
dp[i] = max(dp[i-1], dp[i-2]+nums[i]). Space optimize to two variables.
Q2
#322 Coin Change Medium
Minimum coins to make amount.
dp[a] = min coins for amount a. For each coin, dp[a] = min(dp[a], dp[a-coin]+1). Start dp[0]=0, rest=INF.
Q3
#72 Edit Distance Medium
Minimum operations (insert, delete, replace) to transform word1 to word2.
dp[i][j] = edit distance of word1[0..i-1] and word2[0..j-1]. If chars match: dp[i-1][j-1]. Else: 1 + min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]).
Q4
#312 Burst Balloons Hard
Maximize coins from bursting balloons in optimal order.
Think of k as LAST balloon to burst in range (i,j). dp[i][j] = max coins in open interval (i,j).
Contest Strategy Guide
⚡ The 5-Step Contest Approach
- Read all 4 problems first (5 min). Understand what's being asked. Don't code yet.
- Solve Q1 immediately (10 min). Always starts easy. Quick points, builds confidence.
- Identify patterns for Q3/Q4 before coding Q2. If you recognize Q4's pattern, do it while it's fresh.
- If stuck for 15+ min on a problem: skip it. A partial solution on Q3 may beat a complete Q2 in scoring.
- 10 min before end: review edge cases. Empty arrays, n=1, all same values, negative numbers.
⏱ Time Allocation — the 15 / 30 / 45 rule
- Minute 0–15: bank the easy points. Q1 done and submitted, Q2 read and classified. If Q1 takes longer than 15 minutes, you are overcomplicating it — reread the constraints.
- Minute 15–45: the medium block. Finish Q2, get a working (even suboptimal) Q3. Brute force first: an O(n²) accepted at minute 40 beats an elegant O(n log n) that never compiles. Constraints tell you if brute force passes — n ≤ 2000 means n² is fine.
- Minute 45–90: the hard bet. Pick ONE of Q3-optimization or Q4 based on which pattern you recognized earlier — switching between them halfway wastes both. Write the brute force for the other if partial credit exists.
- Skip signal: 15 minutes without a concrete plan (not code — a plan) means move on. Sunk-cost is the biggest rating killer in contests.
- Never end coding. Last 10 minutes are for edge cases and re-reading problem statements of what you submitted — wrong-answer resubmits cost less than an unfound bug.
🧠 Pattern Recognition Speed Drill
- "Find subarray/substring" → Sliding Window or Prefix Sum
- "Minimum X such that condition" → Binary Search on Answer
- "All combinations/permutations" → Backtracking
- "Dependencies / ordering" → Topological Sort
- "Group / connected" → Union Find or BFS
- "Optimal substructure + overlapping" → DP
- "Next greater/smaller" → Monotonic Stack
- "K-th element or top-K" → Heap (priority_queue)