上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页
摘要: public class Solution { public int Sum_Solution(int n) { int sum = n; boolean flag =(n>0) && (sum+=Sum_Solution(n-1))>0; return sum; } } 阅读全文
posted @ 2019-05-27 21:50 紫色的雪 阅读(412) 评论(0) 推荐(0)
摘要: import java.util.*; public class Solution { public String ReverseSentence(String str) { if(str==null||str.length()==0){ return ""; }if(str.trim().equals("")){ ... 阅读全文
posted @ 2019-05-24 14:41 紫色的雪 阅读(331) 评论(0) 推荐(0)
摘要: import java.util.*; public class Solution { public String LeftRotateString(String str,int n) { if(str.length() list = new ArrayList(); for(int i=0; i 0){ char ch = li... 阅读全文
posted @ 2019-05-23 21:02 紫色的雪 阅读(835) 评论(0) 推荐(0)
摘要: import java.util.*; public class Solution { public ArrayList FindNumbersWithSum(int [] array,int sum) { if(array.length == 0){ return new ArrayList(); } ArrayL... 阅读全文
posted @ 2019-05-23 16:33 紫色的雪 阅读(227) 评论(0) 推荐(0)
摘要: import java.util.*; public class Solution { public ArrayList > FindContinuousSequence(int sum) { if(sum > list = new ArrayList>(); for(int i = 1; i subList = new ArrayList(); ... 阅读全文
posted @ 2019-05-23 14:06 紫色的雪 阅读(142) 评论(0) 推荐(0)
摘要: //num1,num2分别为长度为1的数组。传出参数 //将num1[0],num2[0]设置为返回结果 import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Solution { public void FindNu... 阅读全文
posted @ 2019-05-22 15:37 紫色的雪 阅读(304) 评论(0) 推荐(0)
摘要: public static boolean IsBalanced_Solution(TreeNode root) { if(root == null){ return true; } int left = iterTree(root.left); int right = iterTree(root.rig... 阅读全文
posted @ 2019-05-22 08:14 紫色的雪 阅读(888) 评论(0) 推荐(0)
摘要: //递归方式 public int TreeDepth(TreeNode root) { if(root == null){ return 0; } TreeNode node = root; int left = TreeDepth(node.left); int right = TreeDepth... 阅读全文
posted @ 2019-05-21 09:32 紫色的雪 阅读(914) 评论(0) 推荐(0)
摘要: import java.util.HashMap; import java.util.Map; public class Solution { public int GetNumberOfK(int [] array , int k) { Map map = new HashMap(); if(array.length==0){ re... 阅读全文
posted @ 2019-05-20 21:14 紫色的雪 阅读(134) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页