Long have I pondered whether Abraham was right about the 10 men living in Sodom, Genesis 18-. Would God save the city because of them? Peter tells us that God knew how to rescue Lot as his soul was tortured by the unrighteousness he saw and heard, 2 Peter 2:8.
Ezekiel goes further, 14:12-: If a nation sins and God causes famine & destruction, “even if these three men-Noah, Daniel and Job were in it, they could save only themselves…”
Remember that those who joined Rahab were saved when her city fell.