上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要: 96. Unique Binary Search Trees Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, th 阅读全文
posted @ 2017-04-09 22:04 蓦然闻声 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 530. Minimum Absolute Difference in BST Given a binary search tree with non-negative values, find the minimum absolute difference between values of an 阅读全文
posted @ 2017-04-09 22:03 蓦然闻声 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 520. Detect Capital Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to 阅读全文
posted @ 2017-04-09 22:02 蓦然闻声 阅读(91) 评论(0) 推荐(0) 编辑
摘要: leetcode 105题,由树的前序序列和中序序列构建树结构。详细解答参考《剑指offer》page56. 先序遍历结果的第一个节点为根节点,在中序遍历结果中找到根节点的位置。然后就可以将问题拆分,递归求解。 阅读全文
posted @ 2017-04-09 22:01 蓦然闻声 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 递归方法: 非递归:要借助栈,可以利用C++ STL中的stack。首先将根节点压栈,然后压入栈顶元素的左节点直到叶子节点,然后访问叶子节点后压入该节点的右子节点。 阅读全文
posted @ 2017-04-09 22:01 蓦然闻声 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 437. Path Sum III You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The pa 阅读全文
posted @ 2017-04-09 22:00 蓦然闻声 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 500. Keyboard Row Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the 阅读全文
posted @ 2017-04-09 21:59 蓦然闻声 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 504. Base 7 Given an integer, return its base 7 string representation. Example 1: Input: 100 Output: "202" Example 2: Input: -7 Output: "-10" Note: Th 阅读全文
posted @ 2017-04-09 21:58 蓦然闻声 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 28. Implement strStr() Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 思 阅读全文
posted @ 2017-04-09 21:56 蓦然闻声 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 459. Repeated Substring Pattern Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of t 阅读全文
posted @ 2017-04-09 21:55 蓦然闻声 阅读(92) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页