The verse in 1 Kings 4:30 tells us that Solomon's wisdom exceeded the wisdom of all the east and all of Egypt. The midrash on Kings, preserved in Yalkut Eliezer, offers a story to prove it.

When Solomon resolved to build the Beit HaMikdash, the First Temple, he needed skilled craftsmen and sent a request to Pharaoh Necho, king of Egypt, to hire some out to him.

Pharaoh was cunning. He called in his astrologers and asked them to identify, through their arts, which of the Egyptian craftsmen were fated to die in the coming year. These were the ones he sent to Jerusalem — not his finest, but his doomed, to rid himself of their burial expenses while pretending to help a foreign king.

But Solomon, to whom the Ruach HaKodesh, the Holy Spirit, whispered truth that astrologers could only grasp at, saw through the trick at once. He saw the fate hanging over each man. So he provided every workman with a fine linen shroud and sent them all back to Egypt with a message for Pharaoh: "Have you no shrouds in which to bury your own dead? Behold, here are theirs, prepared."

The verse says Solomon was wiser than all men — "even than Adam, the first man" (1 Kings 4:31). The midrash places him above the astrologers of Egypt too. Solomon did not merely outwit Pharaoh; he turned Pharaoh's trick into his own act of kindness. That is what Jewish wisdom looks like when it has the power of a king.