Diagonal Difference

  • + 1 comment

    Hi,

    I have a question regarding this condition If our numInputs is an odd number

    if(j == k) { leftD += curInput; }

    at some point we will have a (j==k) in rightD as well and at this point the code will add to the leftD and rightD as well which would make the same to give you a wrong answer. Wont It?

    Please forgive me. Noob Question if i havent seen something correctly.