How do you help yourself through a difficult problem?

I can easily ask ChatGPT for the answer but I refuse to do so. I'm dealing with a mind bending logic problem . My friend walked me through a potential solution so I know its not an impossible problem. For context, it just revolves around moving arrays and carefully slicing them, keeping note of the sections you sliced, rearrange them, and putting them back together at the end of the function.

I don't know why its giving me such a headache.

I'm just asking for some advice --- when you're facing a difficult problem what do you do? Do you make a plan and try to break it up into pieces? Perhaps write pseudo code before even coding? I'm also dealing with brain fog so writing this up is helping slightly.