摘要:
题目: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3 阅读全文
摘要:
题目: Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135", return 阅读全文
摘要:
题目: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = "aabcc",s2 = "dbbca", When s3 = "aadbbcbcac", 阅读全文
摘要:
题目: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note:A solution using O(n) spa 阅读全文
摘要:
题目: 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 is 阅读全文
摘要:
KMP算法和Sunday算法代码: 阅读全文
摘要:
题目: 给定一个字符串source和一个目标字符串target,在字符串source中找到包括所有目标字符串字母的子串。 注意事项 如果在source中没有这样的子串,返回"",如果有多个这样的子串,返回起始位置最小的子串。 给定一个字符串source和一个目标字符串target,在字符串sourc 阅读全文
摘要:
题目: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algorithm t 阅读全文
摘要:
题目: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1 阅读全文
摘要:
题目: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may co 阅读全文