Need help for this question


i am not able to solve it. Please help on how to approach this problem.
I am able to comprehend that we need to use lightning spell on from minimum element of row to the maximum. But i am unable to execute it.