Ad
  • Custom User Avatar

    Hi! Could someone please explain this last loop.

    for (int i = 0; i < (n-1)/2; ++i) {
    sumLeft += digits[i];
    sumRight += digits[n-i-1];
    }
    there is variable n which equal zero. isn't it? so why was it compared with i and why reduced it by 1 and divided by 2? I will highly appreciate!