// increment i
i++;
// Shrink sliding window to maintain distinct constraint
leftPointer++;
Complexity Discipline
Always state:
- Time Complexity
- Space Complexity
- Why it works
Example:
We traverse once → O(n) HashMap stores at most n elements → O(n)
Premium Content
Unlock Comments & Complexity Discipline and all premium lessons with a subscription.
All premium lessons
Ad-free experience
Priority support
From ₹199.99/year — See plans