Holmes's client in this story is the King of Bohemia. The King wants Holmes to secure a compromising photograph in possession of his former lover, the opera singer Irene Adler. Beautiful, resourceful, and passionate, Irene has vowed to stop the King's forthcoming marriage to a princess by using this photograph against him.
The King is extremely worried that Irene will succeed in breaking off his marriage. He has already tried several times to get the photograph but with no result. In fact Holmes, for all his ingenuity, does not manage to get it either; Irene ends up fooling them both, and leaves the country. Fortunately for the King, however, she does promise not to carry out her threat after all, as she has now married someone else.
Both the King and Holmes are awe-struck at Irene's cleverness:
'What a woman - oh, what a woman!' cried the King .... 'Would she not have made an admirable queen? Is it not a pity that she was not on my level?'
'From what I have seen of the lady she seems indeed to be on a very different level to your Majesty,' said Holmes coldly.
The King means that Irene is not on his level in terms of social status, but Holmes sardonically twists this to mean that Irene is way above the King in terms of intelligence. Holmes feels rather mortified himself at having been outsmarted by her.