In those days it customary for kings to sit in some public place, where their subjects had wrongs to complain and might plead their case before them, and obtain justice.
The story appears in 1Kings 3:16-28. Two young women who lived in the same house and who both had an infant son came to Solomon for a judgment. One of the women claimed that the other, after accidentally smothering her own son while sleeping, had exchanged the two children to make it appear that the living child was hers. The other woman denied so both women claimed to be the mother of the living son and said that the dead boy belonged to the other.
After some deliberation, King Solomon called for a sword to be brought before him. He declared that there is only one fair solution: the live son must be split in two, each woman receiving half of the child. Upon hearing this terrible verdict, the boy's true mother cried out. However, the liars, in her bitter jealousy, exclaimed "divide it!" Solomon instantly gave the live baby to the real mother, realizing that the true mother's instincts were to protect her child, while the liar revealed that she did not truly love the child. The reputation of Solomon greatly increased when all the people of Israel heard of this wise judgment.
Without any doubt this is one of the most famous' bible stories in the Bible. The only questioned that remained is what happened to the mother of the dead infant!