2016年5月24日

摘要: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: But the fol 阅读全文
posted @ 2016-05-24 19:44 烁宝宝 阅读(178) 评论(0) 推荐(0)
 
摘要: Given a binary tree Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL 阅读全文
posted @ 2016-05-24 19:26 烁宝宝 阅读(241) 评论(0) 推荐(0)
 
摘要: Given a binary tree, flatten it to a linked list in-place. For example,Given The flattened tree should look like: 阅读全文
posted @ 2016-05-24 16:31 烁宝宝 阅读(214) 评论(0) 推荐(0)
 
摘要: Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, return [1,3,2]. 代码如下: 阅读全文
posted @ 2016-05-24 16:03 烁宝宝 阅读(113) 评论(0) 推荐(0)
 
摘要: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For exa 阅读全文
posted @ 2016-05-24 15:55 烁宝宝 阅读(217) 评论(0) 推荐(0)

2016年5月17日

摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2, 阅读全文
posted @ 2016-05-17 17:46 烁宝宝 阅读(133) 评论(0) 推荐(0)

2016年5月13日

摘要: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of 阅读全文
posted @ 2016-05-13 16:30 烁宝宝 阅读(150) 评论(0) 推荐(0)

2016年5月11日

摘要: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 代码如下: 阅读全文
posted @ 2016-05-11 17:57 烁宝宝 阅读(145) 评论(0) 推荐(0)
 
摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo 阅读全文
posted @ 2016-05-11 14:06 烁宝宝 阅读(137) 评论(0) 推荐(0)
 
摘要: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes 阅读全文
posted @ 2016-05-11 11:25 烁宝宝 阅读(168) 评论(0) 推荐(0)