上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页
摘要: public class Solution { public void connect(TreeLinkNode root) { TreeLinkNode lstart=new TreeLinkNode(0); while(root!=null) { TreeLinkNode cur=lstart; ... 阅读全文
posted @ 2017-09-30 09:16 Weiyu Wang 阅读(109) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public void connect(TreeLinkNode root) { TreeLinkNode startNode=root; while(startNode!=null) { TreeLinkNode node=startNode; ... 阅读全文
posted @ 2017-09-30 04:54 Weiyu Wang 阅读(118) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int numDistinct(String s, String t) { int[][] dp=new int[t.length()+1][s.length()+1]; for(int i=0;i<=t.length();i++) for(int j=i;j<=s.length();... 阅读全文
posted @ 2017-09-30 04:44 Weiyu Wang 阅读(116) 评论(0) 推荐(0) 编辑
摘要: class Solution { public void flatten(TreeNode root) { TreeNode cur=root, pre=null; while(cur!=null) { if(cur.left!=null) { pre=cur.... 阅读全文
posted @ 2017-09-30 04:06 Weiyu Wang 阅读(135) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List> pathSum(TreeNode root, int sum) { List> res=new ArrayList>(); pathSum(root, sum, new ArrayList(), res); return res; } private void pa... 阅读全文
posted @ 2017-09-30 02:22 Weiyu Wang 阅读(113) 评论(0) 推荐(0) 编辑
摘要: class Solution { ListNode lnode=null; public TreeNode sortedListToBST(ListNode head) { int size=0; ListNode p=head; while(p!=null) { p=p.next; ... 阅读全文
posted @ 2017-09-30 02:08 Weiyu Wang 阅读(148) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public TreeNode buildTree(int[] inorder, int[] postorder) { return buildTree(inorder, 0, inorder.length-1, postorder, 0, postorder.length-1); } private TreeNo... 阅读全文
posted @ 2017-09-29 12:30 Weiyu Wang 阅读(105) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public TreeNode buildTree(int[] preorder, int[] inorder) { return buildTree(preorder, 0, preorder.length-1, inorder, 0, inorder.length); } private TreeNode bu... 阅读全文
posted @ 2017-09-29 12:12 Weiyu Wang 阅读(108) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List> zigzagLevelOrder(TreeNode root) { List> res=new ArrayList>(); if(root==null) return res; Queue queue=new LinkedList(); Li... 阅读全文
posted @ 2017-09-29 11:36 Weiyu Wang 阅读(115) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List> levelOrder(TreeNode root) { List> res=new ArrayList>(); if(root==null) return res; Queue queue=new LinkedList(); queue.ad... 阅读全文
posted @ 2017-09-29 11:27 Weiyu Wang 阅读(116) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 22 下一页