Doubt in Intuition

Can you share your intuition about this problem in a detailed fashion so as to understand it conceptually?

hi @yaheyafarooqui_8319591c036ff6e9
go through this -->

// Set i and j according to direction

if (i < 0 && j <= n - 1)

i = 0;

if (j == n)

i = i + 2, j--;

}

can you explain these steps from the article linked?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.