Ad
  • Default User Avatar

    hey bros,remember that int_max has 10digit; that is to say ,if one number is >999999999,then it is the FFFFirst longest number

  • Default User Avatar

    My answer is to look for a largest number in the array, in my view ,the largest number always has the longest digit;
    and my algorithm are as follows
    int max =0;
    int digit =0;
    for(int x=0;x<array.length;x++){
    if(Math.abs(array[x])>x){
    max = Math.abs(array[x]);
    digit =x;
    }}
    return array[digit];//since there may be negative number ,so I'm just looking for the index

    but I meet problem with the random test,< expected 1709606145,but was -2143483761>.
    emm,when I come to this sentence ,I get to know why I am wrong. may be 1709606145 is in the front of the second.I feel very sorry.