验证码: 看不清楚,换一张 查询 注册会员,免验证
  • {{ basic.site_slogan }}
  • 打开微信扫一扫,
    您还可以在这里找到我们哟

    关注我们

Java数组、字符和等差数列问题如何解决

阅读:1104 来源:乙速云 作者:代码code

Java数组、字符和等差数列问题如何解决

题目一

Java数组、字符和等差数列问题如何解决

解法

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

题目二

Java数组、字符和等差数列问题如何解决

解法

class Solution {
    public int findLucky(int[] arr) {
        int[] nums = new int[500];
        for(int i =0;i

题目三

Java数组、字符和等差数列问题如何解决

解法

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(left

题目四

Java数组、字符和等差数列问题如何解决

解法

class Solution {
    public boolean canMakeArithmeticProgression(int[] arr) {
        Arrays.sort(arr);
        int num = arr[1]-arr[0];
        
        for(int i = 1;i            
                    
分享到:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: hlamps#outlook.com (#换成@)。
相关文章
{{ v.title }}
{{ v.description||(cleanHtml(v.content)).substr(0,100)+'···' }}
你可能感兴趣
推荐阅读 更多>