Correction: The final challenge guarding the Sorcerer's Stone does involve a logic puzzle with seven potion bottles—Snape's contribution. The flying keys (Flitwick) and giant chess set (McGonagall) are separate obstacles.
Hermione solves a riddle to identify the single potion that allows passage through the black fire forward, and the one that permits retreat through the purple fire.
Hermione deduces the smallest bottle is the forward potion and the rounded bottle at the right end is the backward potion. She drinks the backward potion to return; Harry drinks the forward potion to proceed.
The movie adaptation omits this puzzle entirely, replacing it with extended sequences for the flying keys and chess game. Snape's sole guardian challenge in the novel is the logic puzzle—a rare moment where intellect, not magic or reflex, saves the day.