Here's a breakdown:
* Discovering Voldemort's weakness: Harry discovered that Voldemort's horcruxes were the key to his immortality. By destroying them, he could weaken Voldemort and ultimately defeat him.
* Finding the horcruxes: Using information from Dumbledore, Slughorn's memory, and his own deduction, Harry and his friends identified several of Voldemort's horcruxes:
* Tom Riddle's Diary: Destroyed in *Harry Potter and the Chamber of Secrets*
* Marvolo Gaunt's Ring: Destroyed by Dumbledore
* Salazar Slytherin's Locket: Destroyed by Harry, Ron, and Hermione
* Helga Hufflepuff's Cup: Destroyed by Harry and Hermione
* Rowena Ravenclaw's Diadem: Destroyed by Harry and Luna
* The Final Confrontation: Harry used the knowledge he gained to confront Voldemort in the Battle of Hogwarts. Though Voldemort had created seven horcruxes, Harry destroyed six of them. The final confrontation ended with Harry's sacrifice, during which he was killed by Voldemort, but then resurrected through the connection of the Elder Wand. This ultimately destroyed the final horcrux, Voldemort's soul, and led to his death.
Ultimately, Harry's determination to defeat Voldemort, his intelligence, and his willingness to sacrifice himself were all crucial to solving the problem of how to defeat the Dark Lord.