摘要: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2016-02-21 18:07 哥布林工程师 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the preorder traversal of its nodes' values. Example Given: 1 / \ 2 3 / \ 4 5 return [1,2,4,5,3]. Challenge Can you do it 阅读全文
posted @ 2016-02-21 17:56 哥布林工程师 阅读(191) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the postorder traversal of its nodes' values. Example Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [3,2,1]. Challenge Can 阅读全文
posted @ 2016-02-21 17:45 哥布林工程师 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return all root-to-leaf paths. 这道题主要利用一下java的一个特性,String是immutable的对象,不能修改,只能重新生成 /** * Definition of TreeNode: * public class Tr 阅读全文
posted @ 2016-02-21 11:41 哥布林工程师 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the inorder traversal of its nodes' values. Example Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2]. Challenge Can y 阅读全文
posted @ 2016-02-21 11:07 哥布林工程师 阅读(137) 评论(0) 推荐(0) 编辑
摘要: You have two numbers represented by a linked list, where each node contains a single digit. The digits are stored in reverse order, such that the 1's 阅读全文
posted @ 2016-02-21 10:29 哥布林工程师 阅读(146) 评论(0) 推荐(0) 编辑