import java.util.ArrayList;

/**
 * Created by Lenovo on 2023/10/4.
 */
public class HackerRankTestCompa {
    public static void main(String[] args) {
        int[] intputRatingNumArr1={1,3,2};
        int[] inputRatingNumArr2={3,0,21};
        int[] scoreArr = getSocreArr(intputRatingNumArr1, inputRatingNumArr2);
        ArrayList<Integer> integers = new ArrayList<>();
        for (int i : scoreArr) {
            integers.add(i);
        }
        System.out.println(integers);
    }

    /**
     * 根据输入数组的整数值 intputArr1{1,1,3} inputArr2{13,3,4}
     * 如果inputArr1[0]==inputArr2[0] inputArrRet1Score get 1 socre inputSCoreRet[0]+=1;
     * 如果 inputArr1[1]>inputArr2[1] inputArrRet1Score get 1 score inplutScoreRet[0]+=1;
     * 否则 inputScoreRet[0]+=0; inputScoreRet[1]+=1;
     * 返回数组 {inputScoreRet[0],inputSocreRet[1]}
     * constraints:
     * 1<=a[i]<=100
     * 1<=b[i]<=100
     * @param intputRatingNumArr1,inputRatingNumArr2
     * @return
     */
    public static int[] getSocreArr(int[] intputRatingNumArr1,int [] inputRaingNumArr2){
        if (intputRatingNumArr1==null){
            return null;
        }
        if (inputRaingNumArr2==null){
            return null;
        }
        if (intputRatingNumArr1.length<1 || intputRatingNumArr1.length>100){
            return null;
        }
        if (inputRaingNumArr2.length<1 || inputRaingNumArr2.length>100){
            return null;
        }

        int inputScoreRetAlice=0;
        int inputScoreRetBob=0;
        for (int i = 0; i < intputRatingNumArr1.length; i++) {
            int i1 = intputRatingNumArr1[i];
            int i2 = inputRaingNumArr2[i];
            if (i1==i2){
                continue;
            }else if (i1>i2){
                inputScoreRetAlice+=1;
            }else {
                inputScoreRetBob+=1;
            }
        }

        return new int[]{inputScoreRetAlice,inputScoreRetBob};
    }
}
10-05 08:42