![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
书法教育1
你付出很多,能量守恒,你也会收获很多,相反你总是想着从别人那里得到更多,自己付出很少,也是能量守恒,你日后会为此付出更多。
展开
-
Palindrome Number 带测试版
public class Solution9{ public static boolean isPalindrome(int x) { //Integer m=Integer.parseInt(x); String s=Integer.toString(x); for(int i=0;i<s.length()/2;i++)原创 2016-04-06 19:07:01 · 317 阅读 · 0 评论 -
Add Binary 测试版
public class Solution67 { public static String addBinary(String a, String b) { int aLength = a.length(); int bLength = b.length(); StringBuilder sb = new StringBuilder(); int carry原创 2016-04-27 17:05:48 · 248 阅读 · 0 评论 -
Climbing Stairs 带测试版
public class Solution70 { public static int climbStairs(int n) { int m=0; if(n<=0) return 0; if(n==1) return 1; if(n==2) return 2; int a=1,b=2,c=0;原创 2016-04-27 16:42:27 · 222 阅读 · 0 评论 -
Best Time to Buy and Sell Stock 带测试版本
import java.util.*;public class Solution121 { public int maxProfit(int[] prices) { int le = prices.length, maxD = 0, min = Integer.MAX_VALUE; for (int i = 0; i < le; i++){ min =原创 2016-04-10 21:06:58 · 234 阅读 · 0 评论 -
Length of Last Word 带测试版
public class Solution58 { public static int lengthOfLastWord(String s) { String []ss=s.split(" "); if(ss.length==0) return 0;原创 2016-04-08 21:23:02 · 213 阅读 · 0 评论 -
Palindrome Permutation 带测试版
import java.util.*; public class Solution266 { public static String getPermutation(int n,int k) { k–; int time=n-1; int index,i,j; int fac=1; Lis原创 2016-04-08 12:22:43 · 337 阅读 · 0 评论 -
First Bad Version 带测试版
public class Solution278 extends VersionControl { public int firstBadVersion(int n) { int l=1,r=n; while(l<r){ int mid=l+((r-l)>>1); if (!isBadVersion(mid)) l原创 2016-04-08 12:20:47 · 338 阅读 · 0 评论 -
Move Zeroes 带测试版
public class Solution283 { public static void moveZeroes(int[] nums) { int zeronum=0,unzero=0,i=0; for(i=0;i<nums.length;i++) if(nums[i]==0) zeronum++;原创 2016-04-08 12:19:51 · 318 阅读 · 0 评论 -
Bulls and Cows 带测试版
import java.util.*;public class Solution299 { public static String getHint(String secret, String guess) { char[] se = secret.toCharArray(); char[] gu = guess.toCharArray();原创 2016-04-08 12:16:39 · 377 阅读 · 0 评论 -
Maximum Size Subarray Sum Equals k 带测试版
import java.util.*;public class Solution325{public static int maxSubArrayLen(int[] nums, int k) { int sum = 0, max = 0; HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); f原创 2016-04-08 12:15:36 · 444 阅读 · 0 评论 -
Valid Anagram 带测试版
public class Main { public static boolean isAnagram(String s, String t) { int[] ch=new int[26]; for(char c:s.toCharArray()) { int position=c-'a';原创 2016-04-11 23:12:49 · 210 阅读 · 0 评论 -
Factorial Trailing Zeroes 带测试版
public class Solution172 { public static int trailingZeroes(int n) { int s = 0; while (n>1) s += (n/=5); return s; } public static void main(String[]args)原创 2016-04-06 19:12:13 · 324 阅读 · 0 评论 -
Rotate Array 带测试版
public class Solution189 { public static void rotate(int[] nums, int k) { int i=0; if(k>nums.length) k=k%nums.length; int[] a=new int[nums.length];原创 2016-04-06 19:10:52 · 261 阅读 · 0 评论 -
关于Android Force Close 出现的原因 以及解决方法
导致出现Force Close的原因有很多,常见的有比如空指针啦,类没有找到啦,资源没找到,就连Android API使用的顺序错误也可能导致(比如setContentView()之前进行了findViewById()操作)Force Close有的人说可以用来让应用完全退出 而故意导致这个问题,让程序强制关闭,这种做法我还是不常用。如何避免弹出Force Close窗口 可以实现Thread.Un转载 2016-04-28 23:26:07 · 706 阅读 · 0 评论