随笔分类 -  leetcode

摘要:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1... 阅读全文
posted @ 2014-10-09 10:23 zhidan 阅读(422) 评论(0) 推荐(0)
摘要:Write a function to find the longest common prefix string amongst an array of strings.class Solution: # @return a string #最长公共前缀 def longestC... 阅读全文
posted @ 2014-10-05 19:02 zhidan 阅读(493) 评论(0) 推荐(0)
摘要:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n... 阅读全文
posted @ 2014-09-18 10:17 zhidan 阅读(246) 评论(0) 推荐(0)
摘要:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1... 阅读全文
posted @ 2014-09-17 17:01 zhidan 阅读(191) 评论(1) 推荐(0)
摘要:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... 阅读全文
posted @ 2014-09-16 17:15 zhidan 阅读(266) 评论(0) 推荐(0)