Am i just hardcoding the problem i.e the code is not that efficient and my approach is wrong

Please review my code and explain your approach but not code.Please explain clearly

first divide it into 5 parts

  1. first row
  2. other row before mid and after first row
  3. middle row
  4. below mid and above last
  5. last row
    then make condition for every part
1 Like

Yaaa…please check my code.And tell me few tips to improve I e where iam lagging

That was helpful thankss