SPSneha Poojaryindsamadesimple.hashnode.dev·4d ago · 7 min readTwo Pointers Explained: The Proof Nobody Shows YouEvery algorithm blog on the internet tells you how to move two pointers. Virtually none of them prove why you're allowed to move them, or why the exact same structural logic manages unacknowledged byt00
AAnnetinhtml-portfolio.hashnode.dev·Aug 4 · 4 min readMastering the Two Pointers Technique in Python (With Easy Examples)When I first started solving coding problems, I noticed that many array and string questions looked different but could actually be solved using the same approach: Two Pointers. Instead of using neste00
RKRohit Kumharintech-rohit.hashnode.dev·Jul 23 · 38 min readMaster the Two Pointers Pattern in Python (Part 1): Two Sum, Squares of Sorted Array & Remove DuplicatesIntroduction If you've spent time solving coding interview problems, you've probably noticed a common pattern: many array problems seem to invite a nested loop solution. While that approach works, it 10
VVVidit Vatsindsa-decoded.hashnode.dev·Jul 16 · 5 min readLC-15 3Sum ProblemGiven an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not conta00
VVVidit Vatsindsa-decoded.hashnode.dev·Jul 16 · 2 min readLC 167 Two Sum II - Input Array Is SortedGiven a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1]00
AAAbstract Algorithmsinabstractalgorithms.hashnode.dev·Jul 2 · 2 min readTwo Pointers TechniqueThe two pointers technique uses two indices to iterate over a data structure (typically an array or a linked list) to solve problems with optimal time complexity. It is commonly used to find pairs in 00
SSowmiyainsowmiya.hashnode.dev·May 7 · 4 min readSolving DSA Series - A word on HashMap and Two PointersHello readers! Welcome to my Solving DSA Problems Series - Part 1 In this piece, we're going to be looking at two of the basic concepts - HashMap and Two Pointers. If these terms doesn't feel familiar00
SKShubham Kumar Singhinblog.realdev.club·Apr 7 · 3 min readSegregate 0s and 1s (In-Place Sorting)When I first saw this problem, it looked very simple… But it actually teaches an important concept:How to optimize from 2 passes → 1 pass using two pointers Problem Statement You are given an array c00
MSMuppidi Srinivasinsrinivastechblog.hashnode.dev·Mar 16 · 4 min readSliding Window Technique: A Powerful Tool for Subarray ProblemsSliding Window Technique When solving array or string problems in competitive programming, we often deal with subarrays or substrings. A naive solution usually checks every possible subarray, which le00
ACA Curious Coderinclarity-in-code.hashnode.dev·Feb 14 · 3 min readTwo PointersWhy Do We Even Need Two Pointers? When we first learn arrays, our brain naturally jumps to nested loops. Want to find a pair?Use two loops. Want to compare elements?Two loops. Works? Yes.Efficient? Not really. If an array has 10,000 elements, O(n²) m...00