### Blogroll

### Topics

- Array and linked list
- Backtrack
- Binary search
- Bit operation
- C++
- Complexity
- Divide and Conquer
- Dynamic programming
- File operation
- Geometry
- Graph
- Greedy algorithm
- Hashtable and Map
- Heap
- JAVA
- Large scale data
- Number trick
- Object orientated design
- Probability
- Recursive
- Stack and Queue
- String
- Threads and locks
- Tree
- Uncategorized

### Archives

# Category Archives: Greedy algorithm

## Container With Most Water

Given n non-negative 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 x-axis forms a container, such that the container … Continue reading

Posted in Array and linked list, Greedy algorithm
Leave a comment

## Jump Game II

Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the … Continue reading

Posted in Array and linked list, Greedy algorithm
Leave a comment

## Maximum Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,1,−5,4], the contiguous subarray [4,−1,2,1] has the largest sum = 6. C++: 01 class Solution {02 public:03 int maxSubArray(int A[], int n) {04 … Continue reading

Posted in Greedy algorithm
Leave a comment

## Jump Game

Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. … Continue reading

Posted in Greedy algorithm
Leave a comment

## Container With Most Water

Posted in Array and linked list, Greedy algorithm
Leave a comment

## Jump game

Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum … Continue reading

Posted in Greedy algorithm
Leave a comment