上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要: Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.给出树的前序和中序遍历序列,构... 阅读全文
posted @ 2015-06-13 22:32 niuer++ 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 1:前序遍历(根,左,右)递归的方法很简单:public static void pr(TreeNode root){ if(root!=null){ System.out.println(root.val); pr(root.left); pr(root.right); }} 非递归的方法:... 阅读全文
posted @ 2015-06-13 21:39 niuer++ 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 相当与剑指offer上的面试题19求二叉树的镜像。先前序遍历这棵树的每个结点,如果遍历到的结点有子节点,就交换他的两个子节点,当交换完所有非叶子节点的左右子节点之后,就得到了该二叉树的镜像代码:public TreeNode invertTree(TreeNode root) { i... 阅读全文
posted @ 2015-06-13 10:27 niuer++ 阅读(417) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
posted @ 2015-06-12 21:59 niuer++ 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 买一个大房子,在海边,一个二层小复式楼,爸妈都住在一起,一家人永远永远在一起~ 阅读全文
posted @ 2015-06-12 15:08 niuer++ 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr... 阅读全文
posted @ 2015-06-12 11:27 niuer++ 阅读(136) 评论(0) 推荐(0) 编辑
摘要: ‘\0’是c/c++语言中的字符串结束符,在ASCII字符集中对应数字0。java中不是。另外字符相减是ASSIC码相减0的ASSIC码是49这道题是剑指offer上的第49题,模拟了整个面试的过程。一定要注意代码的鲁棒性,边界条件以及空,或者特殊值下面附上AC代码,用java实现和书上的略不同,不... 阅读全文
posted @ 2015-06-11 18:55 niuer++ 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 关于欲望在著名马斯洛的五大需求“生理需求,安全需求,归属与爱的需求,尊重的需求和自我实现的需求”中,从任意一个细分需求里获得的幸福感只能有那么多。然而快感和幸福感不同,欲望和需求不同。不幸福是因为不小心把快感当成了幸福感,把欲望当成了需求,而原因在于常站在今天的视角去想象未来的感受。不需要拔高理想和... 阅读全文
posted @ 2015-06-10 16:35 niuer++ 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C prog... 阅读全文
posted @ 2015-06-09 12:06 niuer++ 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 早晨和陈John一起来实验室的路上听他说起leetcode上也有数据库和shell的练习。于是拿来练练手,发现数据库的题只有几道而且做得也很快AC率也蛮高,权当复习了一下数据库的基本语法了吧。1:Employees Earning More Than Their ManagersTheEmploye... 阅读全文
posted @ 2015-06-09 10:24 niuer++ 阅读(479) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页