Another interpretation: "a little city" (Ecclesiastes 9:14) — this is the world. "And few people within it" — this is the generation of the Flood. "And a great king came against it" — this is the King of the kings of kings, the Holy One, blessed be He. "And built great siegeworks against it" — as it is said, "And behold, I am about to destroy them with the earth" (Genesis 6:13). "And there was found within it a poor wise man" — this is Noah. "And he, by his wisdom, delivered the city" — "Come, you and all your household, into the ark" (Genesis 7:1). "Yet no one remembered that poor man" (Ecclesiastes, there). The Holy One, blessed be He, said: A man did not remember him, but I remember him, as it is said, "And God remembered Noah" (Genesis 8:1).
The Poor Wise Man Who Saved the World - Noah and the Flood
Midrash Tanchuma Buber, Vayigash 1:2
ד"א עיר קטנה, זה העולם, ואנשים בה מעט, זה דור המבול, ובא אליה מלך גדול, זה מלך מלכי המלכים הקב"ה, ובנה עליה מצודים גדולים, שנאמר והנני משחיתם את הארץ (בראשית ו יג), ומצא בה איש מסכן וחכם, זה נח, ומלט הוא את העיר בחכמתו, בא אתה וכל ביתך אל התבה (שם ז א), ואדם לא זכר את האיש המסכן ההוא (קהלת שם), אמר הקב"ה אדם לא זכרו אבל אני זוכרו, שנאמר ויזכור אלהים את נח (שם ח א).