Binary Seach
Imagine you’re searching for a word in a dictionary.You don’t start from page 1, right?You open somewhere in the middle. If your word comes before → go left If it comes after → go right This is ex

Search for a command to run...
Articles tagged with #algorithms
Imagine you’re searching for a word in a dictionary.You don’t start from page 1, right?You open somewhere in the middle. If your word comes before → go left If it comes after → go right This is ex

Problem Idea You are given an array of size n containing numbers from 1 to n. Your task:Place every number at its correct index Core Idea (Think Like This) “If the current number is not at its correc

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 c

Why Prefix Sum Array? Prefix Sum is a powerful technique used to optimize range sum queries and many subarray problems. In many problems, we are asked: “Find the sum of elements between index l and r

When solving problems on platforms like Codeforces or LeetCode, many beginners face a common issue: TLE (Time Limit Exceeded) Let’s understand this in the simplest way possible. The Hidden Rule: 10⁸
