Kumar Pallavkumarpallav.dev·Dec 19, 20243Sum Closest - Step-by-Step with JavaProblem Statement The problem asks us to find three numbers in an array whose sum is closest to a given target value. Example Input: nums = [-1, 2, 1, -4], **target = 1 **Expected Output**:2` Approach We can solve the problem using the Two Pointer T...Data Structure & Algorithmstwo pointers
Saumyaa Gargsaumyaagarg.hashnode.dev·Dec 13, 2024Day 17: Prefix Sum and Two PointersWelcome to Day 17 of my 100 Days of DSA challenge! Today, I explored two essential techniques: Prefix Sum and Two Pointers. These techniques are incredibly efficient for solving problems related to subarray sums and optimized array traversal. The pro...10 likesWeek 3DSA
Kanchan Raikanchanraiii.hashnode.dev·Nov 22, 2024Day 3 : 100 Days Of DSAHey there, welcome to the day 3 of 100 days of DSA challenge. Today, I’ll be solving some advanced array problems. Here's a quick look at the questions I tackled and how I approached them 🤖✨ Check out my GitHub repository for all my solutions and pr...2 likes·28 reads100 Days of DSAtwo pointers
Tapan Rachchhtapanrachchh.hashnode.dev·Oct 26, 202411. Container With Most Waterclass Solution: def maxArea(self, height: List[int]) -> int: x = 0 l = len(height) y = l - 1 maxWater = 0 for gap in range(l - 1, 0, -1): xVal = height[x] yVal = height[y] ...Python
Enoch Olutunmidawww.thatsametechguy.com·Oct 26, 2024Deleting the Middle Node of a Linked List Using the Tortoise and Hare Algorithm in TypeScriptIntroduction In this post, we’ll be solving LeetCode Problem 2095: “Delete the Middle Node of a Linked List.” The problem statement on LeetCode is: You are given the head of a linked list. Delete the middle node and return the head of the modified l...1 like·36 readsleetcode
Ashikur Rahmanashikonweb.hashnode.dev·Oct 10, 2024Understanding the Two-Pointer TheoryThe two-pointer theory is a technique commonly used to solve array or linked list problems in a more efficient manner. Instead of using nested loops, which can increase the time complexity of a problem, two-pointer theory allows us to traverse the da...1 like·27 readsTutorial
Nguyen Van Tuantuannguyenhust.hashnode.dev·Oct 10, 2024Two pointer with GolangWrite a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. Example 1: Input: s = ["h","e","l","l","o"] Output: ["o","l","l","e","h"] ...Basic algorithmstwo pointers
yuvan bajjurlaalgoinsights.hashnode.dev·Sep 29, 2024Reverse Vowels of a StringHii Viewers, Welcome to my DSA blog let’s dive through the problem of Reversing Vowels of a String. Problem statement Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can ...DSA
SANTOSH SINGHsantoshsingh.hashnode.dev·Sep 1, 2024Mastering the Two-Pointer Technique in Java: A Detailed GuideWhat is the Two-Pointer Technique? The two-pointer technique is a pattern often used in scenarios where you need to search for pairs in a sequence or compare elements in a sorted array or list. As the name suggests, it involves using two pointers, ty...Problem Solvers' Journalthreesum
ddhuuddhuu.hashnode.dev·Jul 19, 2024Mastering the Two Pointers TechniqueIntroduction The Two Pointers technique is a versatile and efficient method commonly used to solve various problems involving arrays, strings, and linked lists. This technique is particularly effective when dealing with pairs or sub-arrays that need ...2 likesDSA