12 2021 档案
摘要:22.括号生成 public List<String> generateParenthesis(int n) { char path[] = new char[n * 2]; List<String> res = new ArrayList<>(); if(n == 0) { return res;
阅读全文
摘要:14.最长公共前缀 public String longestCommonPrefix(String[] strs) { String first = strs[0]; char f[] = first.toCharArray(); int res = first.length(); for(int
阅读全文
摘要:7.整数反转 public int reverse(int x) { boolean isFu = x < 0 ? true : false; x = isFu ? x : -x; int res = 0; int M = Integer.MIN_VALUE / 10; int N = Int
阅读全文
摘要:1.两数之和 public int[] twoSum(int[] nums, int target) { HashMap<Integer,Integer> hm = new HashMap<>(); int res[] = new int[2]; for(int i = 0;i < nums.len
阅读全文
摘要:1.机器人问题,一共有1-N N个位置,机器人可以在1-N上任意移动,初始位置为start,目标位置为aim,可以移动K次,求有几种移动方式 (1)递归实现 public int ways3(int N,int start,int aim,int K) { return process3(start
阅读全文

浙公网安备 33010602011771号