摘要: class Solution { public int minimumTotal(List> triangle) { int[] dp=new int[triangle.size()]; for(int i=triangle.size()-1;i>=0;i--) for(int j=0;j<=i;j++) ... 阅读全文
posted @ 2017-09-30 09:48 Weiyu Wang 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑