To "rack your brain" means to think really hard.
The phrase comes from the medieval torture instrument, the rack, which painfully stretched its victims.
Thus to 'rack your brain' means to "stretch it vigorously to search out the truth like a torturer".