2021年4月17日
摘要: package leetcode; public class demo_70 { public int climbStairs(int n) { int[] f= new int[n+1]; f[1]=1; try { f[2]=2; } catch (Exception e) { // TODO: 阅读全文
posted @ 2021-04-17 10:44 一仟零一夜丶 阅读(40) 评论(0) 推荐(0)
摘要: 1 package leetcode; 2 3 public class demo_8 { 4 public int myAtoi(String s) { 5 //判断是整数还是负数 6 int flag=1; 7 String ss=""; 8 int a; 9 //让空格在“+ -”之后 10 阅读全文
posted @ 2021-04-17 09:21 一仟零一夜丶 阅读(56) 评论(0) 推荐(0)
  2021年4月10日
摘要: package leetcode; public class demo_6 { public String convert(String s, int numRows) { //记录列号 int numCols; String ss=""; //如果只有一行,则不是N型,所以先排除 if(numRo 阅读全文
posted @ 2021-04-10 17:32 一仟零一夜丶 阅读(61) 评论(0) 推荐(0)
  2021年4月9日
摘要: https://writings.sh/post/algorithm-longest-palindromic-substring package leetcode; public class demo_5 { public String longestPalindrome(String s) { S 阅读全文
posted @ 2021-04-09 19:49 一仟零一夜丶 阅读(44) 评论(0) 推荐(0)
  2021年4月5日
摘要: package leetcode; public class demo_14 { public String longestCommonPrefix(String[] strs) { String s=""; int flag=1; try { for(int i=0;i<strs[0].lengt 阅读全文
posted @ 2021-04-05 10:52 一仟零一夜丶 阅读(52) 评论(0) 推荐(0)
  2021年4月3日
摘要: package leetcode; public class demo_67 { public String addBinary(String a, String b) { String s=""; int i=a.length()-1; int j=b.length()-1; int c; //进 阅读全文
posted @ 2021-04-03 10:28 一仟零一夜丶 阅读(66) 评论(0) 推荐(0)
  2021年4月2日
摘要: package leetcode; public class demo_66 { public int[] plusOne(int[] digits) { int arr[]=new int[digits.length+1]; int flag=0; //判断是否进位 int add=1; //排除 阅读全文
posted @ 2021-04-02 21:11 一仟零一夜丶 阅读(63) 评论(0) 推荐(0)
摘要: package leetcode; public class demo_58 { public int lengthOfLastWord(String s) { String [] str=s.split(" "); if(s=="") {return 0;} try { if(str[str.le 阅读全文
posted @ 2021-04-02 16:44 一仟零一夜丶 阅读(45) 评论(0) 推荐(0)
摘要: package leetcode; public class demo_53 { public int maxSubArray(int[] nums) { //动态规划问题 int max; int[] arr =new int[nums.length]; arr[0]=nums[0]; max=n 阅读全文
posted @ 2021-04-02 16:10 一仟零一夜丶 阅读(43) 评论(0) 推荐(0)
  2021年3月29日
摘要: package leetcode; public class demo_38 { public String countAndSay(int n) { String s="1"; int j=1; for(int m=1;m<n;m++) { String s1=""; for(int i=0;i< 阅读全文
posted @ 2021-03-29 11:02 一仟零一夜丶 阅读(44) 评论(0) 推荐(0)