Solution
class Solution { public int[] relativeSortArray(int[] arr1, int[] arr2) { int[] arr = new int[1001]; int[] ans = new int[arr1.length]; int index = 0; for(int i =0;i0){ arr[arr2[i]]--; ans[index] = arr2[i]; index++; } } for(int i =0;i Question 2
Solution
class Solution { public int findLucky(int[] arr) { int[] nums = new int[500]; for(int i =0;iQuestion 3
Solution
class Solution { public int maxPower(String s) { if(s.length()==1) return 1; int left = 1; int max = Integer.MIN_VALUE; int con = 1; while(leftQuestion 4
Solution
class Solution { public boolean canMakeArithmeticProgression(int[] arr) { Arrays.sort(arr); int num = arr[1]-arr[0]; for(int i = 1;iThe above is the detailed content of How to solve Java array, character and arithmetic sequence problems. For more information, please follow other related articles on the PHP Chinese website!