Help me in solving CUTBOARD problem

My issue

hi

My code

# cook your dish here

Problem Link: Cut the Board Practice Coding Problem