摘要:
何谓动态规划? 以菲波那切数列为例, 该递归调用中,有大量重复子集,如图 在计算fib(5) 的时候,多次计算了fib(2)的值。那为何不在递归搜索的基础上,添加一个小笔记本进行记忆化:只在第一次fib(2)的时候计算结果,而下次再call fib(2)的时候, 可以直接O(1)时间从记事本拿到该结 阅读全文
摘要:
A message containing letters from A-Z is being encoded to numbers using the following mapping: Given a non-empty string containing only digits, determ 阅读全文
摘要:
Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen 阅读全文
摘要:
Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. 阅读全文
摘要:
Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the or 阅读全文
摘要:
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). Example: Input: S = "ADOB 阅读全文