Sherlock and Array

  • + 0 comments

    Hi Buddy,

    You have an array index out of bounds in u r code at line 24 because of negative index. Also, add a condition that if length is 1 display YES.

    for( int i = 0 ; i < n ; i++) { lc += a[i-1];

    Cheers. Good Day.