educative.io

Educative

Why can't it be 31?

Th outer loop instruction count is 22 and that is fine. If we take short-circuiting of && into account, the inner loop instruction count will be 9. Hence, the total number of instructions should be 31.

4 Likes

hey. same question. The second comparison of the inner loop should not be executed as the first one would be false for i ==0 thus the second one is not checked.

2 Likes

Short-circuiting is not taken into account for simplicity as in the previous lessons. Hence, the total number of instructions is 32.

1 Like