上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 46 下一页

2014年12月30日

Validate Binary Search Tree

摘要: 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-12-30 20:47 luckygxf 阅读(141) 评论(0) 推荐(0) 编辑

Binary Tree Zigzag Level Order Traversal

摘要: Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al... 阅读全文

posted @ 2014-12-30 19:32 luckygxf 阅读(213) 评论(0) 推荐(0) 编辑

Factorial Trailing Zeroes

摘要: Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.只有2 * 5才会产生0只要计算出因子中2和5的个数取小的... 阅读全文

posted @ 2014-12-30 18:50 luckygxf 阅读(184) 评论(0) 推荐(0) 编辑

2014年12月29日

Construct Binary Tree from Preorder and Inorder Traversal

摘要: Given preorder and inorder traversal of a tree, construct the binary tree.这道题是要根据先序遍历和中序遍历构造出一棵二叉树,这道题和上一题是一样的。上一题不过是通过后序遍历和中序遍历构造一棵二叉树。只要将代码稍稍修改即可 1 ... 阅读全文

posted @ 2014-12-29 20:29 luckygxf 阅读(157) 评论(0) 推荐(0) 编辑

Construct Binary Tree from Inorder and Postorder Traversal

摘要: Given inorder and postorder traversal of a tree, construct the binary tree.根据树的中序(左根右)和后序遍历(左右根)构造一棵二叉树参考:http://www.cnblogs.com/remlostime/archive/20... 阅读全文

posted @ 2014-12-29 19:51 luckygxf 阅读(208) 评论(0) 推荐(0) 编辑

Excel Sheet Column Number

摘要: For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 看成26进制和10进制之间的转换,Excel Sheet Column Title这道题的逆过程 1 public class S... 阅读全文

posted @ 2014-12-29 16:30 luckygxf 阅读(202) 评论(0) 推荐(0) 编辑

2014年12月28日

Convert Sorted List to Binary Search Tree

摘要: Convert Sorted List to Binary Search TreeGiven a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.... 阅读全文

posted @ 2014-12-28 11:32 luckygxf 阅读(184) 评论(0) 推荐(0) 编辑

2014年12月27日

Convert Sorted Array to Binary Search Tree

摘要: Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST.题意:给一个升序排好的... 阅读全文

posted @ 2014-12-27 19:49 luckygxf 阅读(224) 评论(0) 推荐(0) 编辑

2014年12月26日

Longest Substring Without Repeating Characters

摘要: Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters. For example, the ... 阅读全文

posted @ 2014-12-26 19:35 luckygxf 阅读(150) 评论(0) 推荐(0) 编辑

2014年12月24日

Palindrome Partitioning

摘要: Palindrome PartitioningGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioni... 阅读全文

posted @ 2014-12-24 20:39 luckygxf 阅读(180) 评论(0) 推荐(0) 编辑

上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 46 下一页

导航