Illustration of the 'Container With Most Water' problem showing vertical bars and the maximum water area highlighted

Find the container with most water (Blind 75) — O(n) Solution

Problem Overview We are given an array heights of size n. The value at each index represents the height of a vertical bar. We need to find two bars such that together they can hold the maximum amount of water. Note: We are not allowed to slant the container. LeetCode - Container With Most Water Example Input: height = [1,8,6,2,5,4,8,3,7] Output: 49 ...

February 17, 2026 · 2 min · 386 words · Hitesh Patel

Three Sum (Blind 75) — O(n²) Solution

Problem Overview We are given an integer array nums, We need to find all unique triplets [nums[i], nums[j], nums[k]] such that: i != j, i != k, j != k nums[i] + nums[j] + nums[k] == 0 We need to return unique triplets Notice that the order of the output and the order of the triplets does not matter. LeetCode - Three Sum Example Input: [-1, 0, 1, 2, -1, -4] Output: [[-1,-1,2], [-1,0,1]] Explanation: ...

February 15, 2026 · 4 min · 648 words · Hitesh Patel

Search in Rotated Sorted Array (Blind 75) — O(log n) Solution

Problem Overview We are given a sorted array nums of distinct integers The array has been possibly rotated at some pivot k (unknown). Example: Original: [0,1,2,4,5,6,7] Rotated : [4,5,6,7,0,1,2] We must return the index of target if it exists in the array else return -1. The required time complexity is O(log n). LeetCode - Search in Rotated Sorted Array Brute Force Approach The simplest approach is to scan the entire array. ...

February 13, 2026 · 3 min · 437 words · Hitesh Patel

Blind 75: Find Minimum in Rotated Sorted Array — Understanding Binary Search Deeper

Problem Overview We are given an array nums The array was originally sorted in ascending order and then left-rotated by k positions, where 1 < k < n All elements in the array are unique We need to find the minimum element in the array The goal is to design a solution with O(log n) time complexity How I Approached the Problem I follow a strict rule when solving problems like this: ...

February 11, 2026 · 2 min · 342 words · Hitesh Patel

Blind 75: Best Time to Buy and Sell Stock — One Pass Solution Explained

Overview You’re given a list of stock prices where each index represents a day. You are allowed only one transaction: Buy on one day Sell on a future day Your goal is simple: maximize profit. If no profit is possible, return 0. Problem Constraints 1 <= prices.length <= 10^5 Expected time complexity: O(n) Only one buy and one sell Sell must happen after buy How I Approached the Problem I follow a strict rule when solving problems like this: ...

February 6, 2026 · 3 min · 611 words · Hitesh Patel

Blind 75: Two Sum — From Brute Force to Hash Map

Problem Overview We are given an array of integers nums and an integer target. Our Goal is to find two distinct integers from the array, such that their sum is equal to the target and return their indices. Constraints: The array contains at least 2 elements. Exactly one valid solution exists. The goal is to design a solution with O(n) time complexity. Lets Fund out how i approached this problem and what were my thoughts while solving this. ...

January 26, 2026 · 3 min · 493 words · Hitesh Patel