necessity is the mother of invention
Inventiveness and ingenuity are stimulated by difficulty. For example, The first prisoner to tie together bedsheets to escape knew that necessity was the mother of invention. This proverb first appeared in English in 1519 in slightly different form, "Need taught him wit," and exists in many other languages as well.