🧠 1. Standard Kadane's Algorithm 🟢 Easy
- Best Time to Buy and Sell Stock (Conceptually similar) 🟡 Medium
- Maximum Subarray 🔥 (The core Kadane problem)
🌀 2. Circular & Variant Arrays 🟡 Medium
✖️ 3. Product & Multiplication Variants 🟡 Medium
🎯 MUST-DO LIST (If You Have Limited Time)
👉 Master these to understand the power of Kadane:
- Maximum Subarray (Must know)
- Best Time to Buy and Sell Stock
- Maximum Sum Circular Subarray
- Maximum Product Subarray
⚡ Smart Practice Strategy
- The Core Logic: At each step, decide: "Should I add the current element to the existing subarray, or start a new subarray from this element?"
currentSum = Math.max(num, currentSum + num)
- Global Maximum: Always keep track of the best sum seen so far.
maxSum = Math.max(maxSum, currentSum)
- Handle All Negatives: Standard Kadane might need initialization with the first element if the array can contain only negative numbers.
- Circular Arrays: For circular problems, the max sum is either the standard max subarray OR (Total Sum - Minimum Subarray Sum).
| Pattern Category | Total Questions |
|---|---|
| 🧠 1. Standard Kadane's | 2 |
| 🌀 2. Circular & Variants | 3 |
| ✖️ 3. Product Variants | 2 |
| Total Questions | 7 |
| 🎯 Must-Do Problems | 4 |