From this summary of how Bilbo found the Ring in The Hobbit, how did Bilbo beat Gollum at the Riddle game? 
 Gollum was unable to answer Bilbo's last question, "What have I got in my pocket?".