All Posts

Leetcode 1424: Diagonal Traverse II

You are given a 2D array nums, where each sub-array represents a row in the grid. Your task is to return all the elements of nums in diagonal order, starting from the top-left to bottom-right diagonals, where the sum of the row and column indices is constant.

Leetcode 1438: Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit

Given an array of integers nums and a positive integer limit, determine the length of the longest subarray where the absolute difference between the minimum and maximum elements is less than or equal to limit.

Leetcode 1464: Maximum Product of Two Elements in an Array

Given an array of integers, you need to find two distinct elements and calculate the product of their decremented values. Specifically, you are tasked with returning the maximum value of (nums[i] - 1) * (nums[j] - 1) for two different indices i and j in the array.

Leetcode 1488: Avoid Flood in The City

Your country has an infinite number of lakes. Initially, all the lakes are dry, but on the nth day, the nth lake fills up with water. If it rains over a lake that is already full, there will be a flood. You need to avoid flooding by drying out lakes on some days when there is no rain.

Leetcode 1514: Path with Maximum Probability

You are given an undirected, weighted graph of n nodes, represented by an edge list, where each edge connects two nodes with a given success probability. Given two nodes, start and end, find the path with the maximum probability of success to go from start to end.

Leetcode 1631: Path With Minimum Effort

You are a hiker navigating a terrain represented by a 2D grid of heights. Your goal is to find the path from the top-left corner to the bottom-right corner that minimizes the maximum height difference between any two consecutive cells.