上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页
摘要: public int lengthOfLongestSubstring(String s) { // 开一个hashmap来维护情况,进行一个N*N的搜索 Map<Character, Boolean> map; int len = s.length(); if(len == 0) return 0 阅读全文
posted @ 2022-02-07 22:09 明卿册 阅读(12) 评论(0) 推荐(0) 编辑
摘要: public List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> ans = new ArrayList<>(); List<Integer> combine = new ArrayList<>(); dfs(nums, an 阅读全文
posted @ 2022-02-06 21:42 明卿册 阅读(18) 评论(0) 推荐(0) 编辑
摘要: public void rotate(int[][] matrix) { int n = matrix.length, m= n-1; for(int i = 0; i < n/2; i++) { for(int j = 0; j < n/2; j++) { int tmp = matrix[i][ 阅读全文
posted @ 2022-02-06 21:32 明卿册 阅读(16) 评论(0) 推荐(0) 编辑
摘要: public int maxSubArray(int[] nums) { int len = nums.length,ans = nums[0]; int[] dp = new int[len]; dp[0] = nums[0]; for(int i = 1; i < len; i++) { dp[ 阅读全文
posted @ 2022-02-04 22:06 明卿册 阅读(12) 评论(0) 推荐(0) 编辑
摘要: public int maxProfit(int[] prices) { if(prices.length < 2) return 0; int ans = 0, beforeMin = prices[0]; for(int i =1; i < prices.length; i++) { int p 阅读全文
posted @ 2022-02-04 21:31 明卿册 阅读(20) 评论(0) 推荐(0) 编辑
摘要: public int findDuplicate(int[] nums) { Arrays.sort(nums); System.out.println(Arrays.toString(nums)); int l = 0, r = nums.length - 1; while (l < r) { i 阅读全文
posted @ 2022-02-03 21:31 明卿册 阅读(12) 评论(0) 推荐(0) 编辑
摘要: public int findInMountainArray(int target, MountainArray mountainArr) { int len = mountainArr.length(); int l = 0, r = len; while(l < r) { int mid = l 阅读全文
posted @ 2022-02-03 21:05 明卿册 阅读(31) 评论(0) 推荐(0) 编辑
摘要: ``java public List<List> combinationSum(int[] candidates, int target) { List<List> ans = new ArrayList<>(); List combine = new ArrayList<>(); dfs(cand 阅读全文
posted @ 2022-02-01 20:18 明卿册 阅读(23) 评论(0) 推荐(0) 编辑
摘要: `private int m,n; private int[] dx = {-1, 0, 1, 0}; private int[] dy = {0, -1, 0, 1}; public int minPathSum(int[][] grid) { m = grid.length; n = grid[ 阅读全文
posted @ 2022-02-01 18:10 明卿册 阅读(22) 评论(0) 推荐(0) 编辑
摘要: public List<List> combinationSum(int[] candidates, int target) { List<List> ans = new ArrayList<>(); List combine = new ArrayList<>(); dfs(candidates, 阅读全文
posted @ 2022-01-29 22:52 明卿册 阅读(19) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 15 下一页