文章浏览阅读27次。public static int[] sortedSquares(int[] nums) { int len = nums.length; int[] result = new int[len]; for(int i = 0,j = len - 1,pos = len -1;i <=j;){ if(nums[i] * nums[i] > nums[j] * nums[j]){ res......
文章浏览阅读39次。public static int[] sortedSquares(int[] nums) { int len = nums.length; int[] result = new int[len]; for(int i = 0,j = len - 1,pos = len -1;i <=j;){ if(nums[i] * nums[i] > nums[j] * nums[j]){ res......
文章浏览阅读41次。//时间复杂度O(n),空间复杂度 O(s.length()) public int lengthOfLongestSubstring(String s) { if(s == null || s.length() == 0){ return 0; } HashSet<Character> set = new HashSet<>(); int rk = -1, ans = 0......
文章浏览阅读41次。首先可以看看这个链接,讲解的还可以,不多通不过,因为有问题,可以先找它的问题,再看下面的代码public int[] LIS (int[] arr) { // write code here int dp[] = new int[arr.length]; int temp[] = new int[arr.length];......