Saturday, July 26, 2025

✅ Topics for Day 6 DSA with Java

Focus: Two Pointer Technique


🔁 1. Learn & Implement Two Pointer Technique

  • Understand how the two-pointer technique works on sorted arrays.

  • Implement the following problems:


// Java Example: Two Sum (Sorted Array) public int[] twoSum(int[] numbers, int target) { int left = 0, right = numbers.length - 1; while (left < right) { int sum = numbers[left] + numbers[right]; if (sum == target) { return new int[] { left + 1, right + 1 }; // 1-indexed } else if (sum < target) { left++; } else { right--; } } return new int[] {}; // no solution }

🧠 2. Solve 2 LeetCode Problems Using Two Pointers

  1. LeetCode 167. Two Sum II – Input Array Is Sorted

  2. LeetCode 283. Move Zeroes


✨ Bonus Challenges (Optional but Recommended)


📊 Explore Visualization

Try two-pointer visualizations at:
👉 https://visualgo.net/en/list


🧩 Concept Summary

No comments:

Post a Comment

✅ UNIT 4 — POSET, LATTICES & BOOLEAN ALGEBRA (DISCRETE MATHEMATICS)

  ✅ UNIT 4 — POSET, LATTICES & BOOLEAN ALGEBRA 1. Poset Partially Ordered Set A pair (A, ≤) where relation is: Reflexive Anti-...