beat one's brains out

[beat one's brains out] or [beat one's brains] {v. phr.}, {slang} To try very hard to understand or think out something difficult; tire yourself out by thinking.

It was too hard for him and he beat his brains out trying to get the answer.

Some students are lazy, but others beat their brains and succeed.