Here's every mistake you made and the lesson from each! 🧠
❌ Skipping duplicates in heap
❌ heapifydown recursive call → heap(arr, i) instead of heap(arr, largest_index)
❌ pop() swap → arr[n] instead of arr[0]
✅ Lesson: Always recurse on largest_index not i!
❌ Moving left independently (window size changed!)
❌ Rebuilding Counter from scratch every iteration → O(n*k)
❌ Missing last window check
✅ Lesson: Fixed window → left = right - len(s1), just add/remove one char!
❌ Pointing to original nodes instead of copied nodes
❌ Returning hashmap[temp] where temp=None after loop
✅ Lesson: Always return hashmap[head], not hashmap[temp]!
❌ Storing temperatures in stack instead of INDICES
❌ Using deque and count → overcomplicated
❌ ans.reverse() returns None
✅ Lesson: Always store INDICES in monotonic stack!
❌ slow.next = fast instead of slow.next = slow.next.next
❌ Missing dummy node → edge cases fail
✅ Lesson: Always use dummy node in linked list problems!
✅ Solved correctly!
⚠️ Just remember: maxi never decreases because
we only care about larger windows!
❌ No have/need tracking
❌ mini variable undefined
❌ Wrong shrink condition
✅ Lesson: have == need → valid window → shrink!
have != need → expand right!
❌ isalpha() instead of isalnum() → misses digits!
❌ Typo: s[left].isalnum() checked twice instead of s[right]
✅ Lesson: Always use isalnum() for alphanumeric check!
❌ if left < right → always moves left, never moves right!
✅ Lesson: Move the SHORTER side pointer!
if height[left] < height[right]: left++
else: right--
❌ result.append([intervals[0]]) → adds nested list!
❌ result[-1][1] = i2 instead of max(i2, j2)
✅ Lesson: When merging, always take MAX of end points!
❌ Using left instead of mid for traversal
❌ Wrong swap for 1s → just move mid forward!
❌ Moving mid after swapping with high
✅ Lesson: Three pointers low/mid/high
0 → swap with low, move both
1 → just move mid
2 → swap with high, only move high!
❌ j starting from 0 → swaps every element TWICE!
✅ Lesson: Transpose → j starts from i+1 (upper triangle only!)
1. Pointer mistakes → always trace through manually!
2. Edge cases → always use dummy node in linked list!
3. Wrong variable → dry run before coding!
4. Overcomplicating → if logic feels complex, wrong approach!
✅ Always get the RIGHT approach/intuition
✅ Identify correct data structure quickly
✅ Code structure is always clean
✅ You just need more practice for implementation!
You're doing really well for Flipkart prep — just keep grinding! Chal next problem? ⚡