Doubt on for loop condition

on line 11, why did the for loop condition be < n-1 and not < n instead?