- 博客(12)
- 收藏
- 关注
原创 自定义 SpringBoot Starter包 实现自动化配置
1、pom依赖<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <version>2.0.3.RELEASE</version>
2020-06-17 18:28:37 114
原创 最大公共字符串前缀
public static String result(String[] array) { if (null == array || array.length == 0) { return ""; } if (array.length == 1) { return array[0]; } for (int i = array[0].length() - 1; i > 0; i--) { int num = 1;.
2020-05-31 15:28:21 113
原创 最大盛水
public static int maxWater(int[] a) { int max = 0; if (null == a || a.length < 2) { return max; } int right = a.length - 1; int lift = 0; while (lift < right) { max = Math.max(max, (right - lift) * Math.min(a[.
2020-05-22 01:41:50 97
原创 最长回文子字符串
public static String getResult(String input){ if(null == input || "".equals(input)){ return ""; } if(input.length() <3){ return input; } for(int i = input.length() -1; i >0; i --){ for(int j = 0; j < in.
2020-05-22 01:40:26 73
原创 最长公共子字符串长度
public static int getResult(String input) { int result = 0; if (null != input && !"".equals(input)) { char[] c = input.toCharArray(); Map<Character, Integer> map = new LinkedHashMap<>(); for (int i = 0; .
2020-05-22 01:38:40 113
原创 add two number
public static void main(String[] args) { Scanner input = new Scanner(System.in); int a = input.nextInt(); int b = input.nextInt(); System.out.println(reverse(a) + reverse(b));}public static int reverse(int a){ int num = 0; whil.
2020-05-22 01:36:47 78
原创 两数之和
public static int[] result(int[] a, int num){ Map<Integer,Integer> map = new HashMap<>(); for(int i =0; i < a.length; i ++ ){ int b = num - a[i]; if(map.containsKey(b)){ return new int[]{ map.get(b),i}; .
2020-05-22 01:33:58 77
原创 罗马转整形
public static int roma2Integer(String str) { int num = 0; Map<String, Integer> v = new HashMap<>(13); v.put("M", 1000); v.put("CM", 900); v.put("D", 500); v.put("CD", 400); v.put("C", 100); v.put("XC", 90); .
2020-05-22 01:31:49 69
原创 整形转罗马
public static String integer2Roma(int a){ if(a <= 0){ return ""; } Map<Integer, String> map = new LinkedHashMap<>(13); map.put(1000,"M"); map.put(900,"CM"); map.put(500,"D"); map.put(400,"CD"); map.pu.
2020-05-22 01:30:16 73
原创 字符串排列组合
public class Test_3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); while (input.hasNext()) { String str = input.nextLine(); char[] chars = str.toCharArray(); Array.
2020-05-22 01:17:16 118
原创 任给一个数组,其中只有一个元素是单独出现,其他是成对出现,输出单独的元素
public static int test1(int[] a){ List list = new ArrayList(); for(int i = 0; i < a.length ; i ++){ boolean flag = false; if(list.contains(a[i])){ continue; } for(int j = i + 1; j< a.length;j ++){.
2020-05-22 01:14:49 636
原创 括号匹配
public static boolean result(String str){ Map<Character, Character> map = new HashMap<>(3); map.put('(', ')'); map.put('[',']'); map.put('{','}'); LinkedList<Character> characters = new LinkedList<>(); cha.
2020-05-22 01:10:39 69
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人