240. Search a 2D Matrix II

Problem description:

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:

Readmore

295. Find Median from Data Stream

Problem description:

Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.

Readmore

146. LRU Cache

Problem description:

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put.

Readmore

220. Contains Duplicate III

Problem description:

Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and nums[j] is at most t and the absolute difference between i and j is at most k.

Readmore

c++ map bound

It’s a very useful function to find elements in map.

iterator lower_bound (const key_type& k);
Returns an iterator pointing to the first element in the container whose key is not considered to go before k (i.e., either it is equivalent or goes after).

Readmore

219. Contains Duplicate II

Problem description:

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k.

Readmore

217. Contains Duplicate

Problem description:

Given an array of integers, find if the array contains any duplicates.

Readmore

71. Simplify Path

Problem description:

Given an absolute path for a file (Unix-style), simplify it.

Readmore

674. Longest Continuous Increasing Subsequence

Problem description:

Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray).

Readmore

210. Course Schedule II

Problem description:

There are a total of n courses you have to take, labeled from 0 to n-1.

Readmore