Problem Statement 556. Next Greater Element III Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive integer exists, return -1. Note: T...
Problem Statement LeetCode 457 Circular Array Loop: Cycle Detection with Direction Consistency Given an array where each element represents a step size, you start at any index and follow the steps. The goal is to find if there's a cycle that: Cont...
Imagine going through a list once and solving a problem that would otherwise need nested loops and a prayer. That’s the magic of Two Pointers and Sliding Windows — algorithms that give you O(n) time for problems that feel like they should be O(n²). I...
LeetCode 143 Reorder List LeetCode 143 "Reorder List" requires transforming a linked list from L₀ → L₁ → L₂ → ... → Lₙ₋₁ → Lₙ into L₀ → Lₙ → L₁ → Lₙ₋₁ → L₂ → Lₙ₋₂ → ... The solution uses a three-step approach: Find the middle using the two-pointer t...
443. String Compression Algorithm Overview The solution implements an in-place string compression algorithm using a two-pointer approach. Here's how it works: read: scans through the original characters write: tracks where to place the compressed o...
Sliding Window is one of the most efficient and elegant techniques used in solving problems involving arrays or strings. Especially useful when you're dealing with subarrays or substrings, it allows you to reduce time complexity by avoiding unnecessa...
📌 1. What is Two Pointers? The Two Pointers technique uses two variables (usually indices) to traverse a list or string from different directions (e.g., start and end).By controlling the movement of these pointers, you can solve problems more effici...
Today I officially started my grind toward 1400+ on CodeChef. I’ve kept the first day light but insightful — focused mostly on two-pointer logic, frequency maps, and a neat parity-based math problem. Here’s what I worked on: 🔹 Problem 1: LeetCode 9...
📅 Date: June 25, 2025 🧹 Problem: Given two sorted arrays, find the k-th smallest product that can be formed by multiplying one element from each array. 🔗 LeetCode link 🏷️ Tags: Binary Search, Two Pointers, Math 🚀 Problem Summary You're given t...
Hey folks! Today I encounted a problem which I tried solving 2 years back (2023) Question Link → 1498. Number of Subsequences That Satisfy the Given Sum Condition So, looking at my 2 year old attempt, I wanted to challenge myself to solve it this ti...