We know that he was very talented but he was also hardworking since even Dumbledore mentioned him being one of the best students in Hogwarts history. This would basically mean that he got the best grades in at least 10 O.W.L.'s (if not all of them) while being prefect and Head Boy. He also explored dark magic at the time and by the end of his schooling he knew almost all areas of magic to the same point as professionals did. How could he manage all that? Did he spend most of his time in the library or what?