Tag: Array

Leetcode 11 Container With Most Water
Problem 11 Container With Most Water Given n nonnegative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with xaxis forms…

Leetcode 64 Minimum Path Sum
Problem 64 Minimum Path Sum Given a m x n grid filled with nonnegative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at any point in time. Similar to…

Leetcode 75 Sort Colors
Problem 75 Sort Colors Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue. Here, we will use the integers 0, 1, and 2 to represent the color…

Leetcode 121 Best Time to Buy and Sell Stock
Problem 121 Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock)…

Leetcode 62 Unique Paths
Problem 62 Unique Paths A robot is located at the topleft corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottomright corner of the grid…