Well, considering that Despereaux is a mouse full of problems, answering this question is a pretty tough task, ... or perhaps I should say a tough quest. Therefore, considering your question is quite general, I will focus upon the completion of Despereaux's quest: rescuing the Princess Pea from the dungeon.
In reality, the answer to this question lies in the full title of this novel which is The Tale of Despereaux: Being the Story of a Mouse, a Princess, Some Soup, and a Spool of Thread. Each of these four "items" has its place in solving Despereaux's problem. That being said, there isn't really one thing that solves Desperaux's problem. It is a combination of things. However, the main thrust of the problem is solved through Despereaux's bravery: his willingness to go back into the dungeon by choice.
He had nothing but a sewing needle with which to defend himself. he had to find a princess. And he had to save her once he found her. "It's impossible," he said to the darkness. "I can't do it." He stood very still. "I'll go back," he said. But he didn't move. "I have to go back." He took a step backward. "But I can't go back. I don't have a choice. I have no choice." He took one step forward. And then another. "No choice," his heart beat out to him as he went down the stairs, "no choice, no choice, no choice."
The irony here is that Despereaux does in fact have a choice, and he chooses to save the princess. Then the ball is set in motion. Despereaux drops the spool of thread which rolls into a horrid rat who smells soup on Despereaux's whiskers. In hopes of a meal, this rat leads Despereaux directly to the princess. The Princess Pea, Roscuro (the kidnapper-rat), and Miggery Sow (the poor, misguided servant girl) are sitting in the dungeon at an impasse until Despereaux's cry of "PRINCESS! ... Princess, I have come to save you!"
Suddenly, the smell of soup on Despereaux's whiskers sparks an epiphany in Roscuro, who realizes he doesn't want to do these bad things, ... he only wants light, ... and soup. The Princess Pea promises Roscuro soup, ... and that is how they exit the dungeon.
Thus, the phrasing of the question "how does Despereaux solve his problem?" is a bit misleading. He solves his problem through bravery, but it is a collaboration of bravery and epiphany and even serendipity that leads the reader to resolution.