beat your brains out
US /biːt jʊər breɪnz aʊt/
UK /biːt jʊər breɪnz aʊt/

1.
to think very hard about a problem or question, often without success
:
•
I've been beating my brains out trying to solve this puzzle all day.
•
Don't beat your brains out over it; let's just ask for help.