How did you figure out how to solve these difficult physics problems?
Is it awkward to use "how" twice in the same question?
Yes, it can be grammatically correct, and it is grammatically correct in your example.
There's no rule in grammar that precludes using the same word twice in a sentence or even in sequence, so we have people quite aptly saying things like, "It's alarming that that is what you want," and, "Where she is is what we need to focus on now," in addition to things like, "How did you figure out how to do that?"
In fact, using the same word more than once in a sentence, each time with a different definition, is a literary or rhetorical device called an antanaclasis, an example of which is President Roosevelt saying, "The only thing we have to fear is fear itself." The employment of such devices is an indicator of good wordsmithing.