摘要:
算法描述: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. 阅读全文
摘要:
算法描述: Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence of a string is a new string which 阅读全文
摘要:
算法描述: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Example 1: Example 2: Follow 阅读全文
摘要:
算法描述: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. Example 1: Example 2: 解题思路:动态规划题。s3中的字符要么与s1中的字符相同,要么与s2中的字符相同。 递推 阅读全文
摘要:
算法描述: Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible repres 阅读全文
摘要:
算法描述: Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example: 解题思路:利用直方图最大面积求解, 阅读全文
摘要:
算法描述: Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in th 阅读全文
摘要:
算法描述: 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: Note: If t 阅读全文
摘要:
算法描述: Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) 阅读全文
摘要:
算法描述: Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2. You have the following 3 operations p 阅读全文