Use more space to improve time complexity.
Description
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
A complicated backtracking problem in matrix form.
Classic two dimensional dp problem.
Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0.
text1
text2
0
Backtracking is used in specific cases of DFS. Global variable / parameter may be modified across different level of search. However, when search returns, the variable / parameter needs to be at original state for the new search, where backtracking should occur.
Combining hash table and in place manipulation in array.
Implement the RandomizedSet class:
RandomizedSet
RandomizedSet()
Basic example implementation of dynamic programming.
Given an integer array nums, handle multiple queries of the following type:
nums
Sliding windowe is a special kind of two pointers. This technique is often used to find extremum…
Two pointers are very commonly used in leetcode problems. The purpose is mostly to turn nested loop…
BFS in tree follows pretty fixed template.
While the concept is two pointers converging from opposite sides, the implementation is more in a dp form.
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how…
n
1