2021年4月17日
摘要: package leetcode; import java.util.HashMap; public class demo_12 { public String intToRoman(int num) { String s=""; HashMap<Integer, String> hm= new H 阅读全文
posted @ 2021-04-17 22:36 一仟零一夜丶 阅读(40) 评论(0) 推荐(0)
摘要: 1 package leetcode; 2 3 public class demo_28 { 4 public int strStr(String haystack, String needle) { 5 int i; 6 if(needle=="") {return 0;} 7 if(haysta 阅读全文
posted @ 2021-04-17 21:41 一仟零一夜丶 阅读(40) 评论(0) 推荐(0)
摘要: 牛顿迭代法 1 package leetcode; 2 3 public class demo_69 { 4 public int mySqrt(int x) { 5 long t=x; 6 while(t*t>x) { 7 t=(t+x/t)/2; 8 } 9 return (int)t; 10 阅读全文
posted @ 2021-04-17 11:36 一仟零一夜丶 阅读(64) 评论(0) 推荐(0)
摘要: 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)