Urvashi Jain (@urvicodes) header
Urvashi Jain (@urvicodes) profile picture

- 20s | Indian dev girl - Building https://nitter.gq/t.co/eBmG7zusSP 🚀 - AI and Tech - sometimes I roast in comments - https://nitter.gq/t.co/CfeM8oipox

Remote
Joined November 2025
Starting new on @X… any advice is appreciated 🙏 Specifically: what should I NOT post?
🤖 Made with AI
70
1
1
128
9,178
1️⃣1️⃣ Final Cheat Code Remember this: 🧠 “Left for Larger, Right for Smaller.” That one sentence solves half the confusion.
3
109
🔟 The Biggest Insight The pattern works because: > Sorted order gives directional certainty. > You KNOW which pointer to move. > That’s what eliminates unnecessary comparisons. > And that’s why it’s so efficient.
1
3
136
9️⃣ Common Mistakes ❌ Forgetting to sort ❌ Pointer out-of-bounds ❌ Not skipping duplicates in 3Sum ❌ Using brute force first Pro tip: Always ask: Can I solve this by moving inward from both ends?
1
1
78
8️⃣ Interview Signals Whenever you see: ✅ Sorted array ✅ Pair/triplet target ✅ Need optimization ✅ O(N) or O(N²) hint Immediately think: 🧠 Two Pointers.
1
1
10
7️⃣ Mental Model That Makes It Click Imagine: You and your friend stand at opposite ends of a number line. If your total is too small: ➡️ move toward bigger numbers If total is too large: ⬅️ move toward smaller numbers That’s literally the entire pattern.
1
1
21
6️⃣ The REAL Power → 3Sum This pattern becomes deadly powerful in problems like: > 3Sum > 4Sum > Triplets with target > Closest sum problems > Palindrome checks > Sorted squares For 3Sum: > Fix one element > Use two pointers on remaining array That converts: O(N³) → O(N²) Massive optimization.
1
1
105
5️⃣ Classic Problem: Two Sum (Sorted Array) Array: [1, 2, 3, 4, 6] Target = 6 Start: 1 + 6 = 7 → too big Move right 1 + 4 = 5 → too small Move left 2 + 4 = 6 ✅ Found. No nested loops needed.
1
1
30
4️⃣ Core Pointer Logic While left < right: ✅ If sum == target → found answer ✅ If sum < target → move left++ ✅ If sum > target → move right-- Easy rule to remember: 👉 Left increases value 👉 Right decreases value
1
1
9
3️⃣ Time Complexity Advantage Brute force: > Check every pair > O(N²) Two pointers: > Single scan > O(N) Huge difference. Especially in coding interviews.
1
1
14
2️⃣ Why is sorting important? Sorting gives predictability. Example: Target = 10 Current pair = 3 + 4 = 7 Too small? Move LEFT pointer right → bigger value. Current pair = 8 + 9 = 17 Too large? Move RIGHT pointer left → smaller value. Instead of checking every pair, you intelligently eliminate possibilities. That’s the magic.
1
1
29
1️⃣ What is the Converging Two Pointers Pattern? You place: > One pointer at the START > One pointer at the END Then move them toward each other based on conditions. This works beautifully on SORTED arrays. Think of it like: Two people walking from opposite ends of a hallway until they meet.
1
1
51
🧵 This One Pattern Silently Solves Some of the Hardest Array Problems in Coding Interviews Most people memorize solutions for: > Two Sum > 3Sum > Container With Most Water > Palindrome checks > Sorted Squares Top candidates notice they're all variations of the SAME pattern. Once this clicks, array problems start feeling predictable instead of random. Here’s the simplest explanation of the Converging Two Pointers technique👇
🤖 Made with AI
3
8
401