Restore the array to a partially sorted state so the first element not consecutive with the previous suggests the missing value.
Description
While binary search seems an ordinary technique, there are many special cases that require some…
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.