As David M's comment suggests, this question focuses to some extent on a more general issue of when to use "a strength" (as in "The alien's tentacles possessed a hideous strength [that is, a kind or degree of strength that was hideous]") versus "the strength" (as in "If the alien has the strength [that is, the necessary strength] to break down our pressure-sealed door, we're doomed").
But you also seem to be asking about when to put an article of any kind before strength versus when to leave strength unadorned (as in "God give me strength to endure these aliens.")
The differences in tone that result from these various choices are difficult to generalize about, and in some cases the results are virtually identical. Your example—
She's doing exercises to build up the strength in her legs.
—offers a case in point: The only effective difference between the sentence with the definite article included and the sentence with the definite article dropped, as in
She's doing exercises to build up strength in her legs.
is that the original wording takes as its starting point the strength that already exists in the person's legs, whatever it might be. From that starting point, the sentence looks at the idea of building up additional strength to augment the strength that is already there.
In contrast, the second version of the sentence doesn't rule out the possibility that the person may have had essentially no strength in her legs when she began her exercise program. She might or she might not have some meaningful leg strength already; but our starting point is that we know nothing about that matter, and our attention is immediately directed to the question of building up her leg strength from the unknown starting point.
Either way, we quickly move on to the main point of the sentence, which is that the person is making a transition from less (or no) strength in her legs to more strength in her legs.