摘要:
public class Solution { public void connect(TreeLinkNode root) { TreeLinkNode lstart=new TreeLinkNode(0); while(root!=null) { TreeLinkNode cur=lstart; ... 阅读全文
摘要:
public class Solution { public void connect(TreeLinkNode root) { TreeLinkNode startNode=root; while(startNode!=null) { TreeLinkNode node=startNode; ... 阅读全文
摘要:
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();... 阅读全文
摘要:
class Solution { public void flatten(TreeNode root) { TreeNode cur=root, pre=null; while(cur!=null) { if(cur.left!=null) { pre=cur.... 阅读全文
摘要:
class Solution { public List> pathSum(TreeNode root, int sum) { List> res=new ArrayList>(); pathSum(root, sum, new ArrayList(), res); return res; } private void pa... 阅读全文
摘要:
class Solution { ListNode lnode=null; public TreeNode sortedListToBST(ListNode head) { int size=0; ListNode p=head; while(p!=null) { p=p.next; ... 阅读全文