All Posts

Leetcode 11: Container With Most Water

You are given an array of integers where each integer represents the height of a vertical line drawn on a 2D plane. The x-axis is represented by the index of the array, and each line’s height corresponds to the value at that index. Your task is to find two lines that, along with the x-axis, form a container that can hold the most water. The container’s area is determined by the distance between the lines and the height of the shorter line.

Leetcode 45: Jump Game II

You are given a 0-indexed array ’nums’ where each element represents the maximum length you can jump forward from that index. You are initially positioned at nums[0], and you need to reach the last index. Return the minimum number of jumps needed to reach the last index.

Leetcode 55: Jump Game

You are given an integer array nums. Starting from the first index, each element represents the maximum jump length you can make from that position. Return true if you can reach the last index, or false otherwise.

Leetcode 134: Gas Station

You are given ’n’ gas stations along a circular route, where each station has a certain amount of gas and a cost associated with traveling to the next station. The goal is to find the starting station from where you can complete a full circle. If no such starting station exists, return -1.

Leetcode 316: Remove Duplicate Letters

Given a string ’s’, remove duplicate letters so that every letter appears once and only once. The result should be the smallest lexicographical order among all possible results.

Leetcode 324: Wiggle Sort II

You are given an array of integers. Your task is to reorder the array such that the elements alternate between smaller and larger numbers. The sequence should follow the pattern nums[0] < nums[1] > nums[2] < nums[3] > nums[4]….