TL;DR: struggling with a problem before being told the answer makes you learn better.
Students who are presented with unfamiliar concepts, asked to work through them, and then taught the solution significantly outperform those who are taught through formal instruction and problem-solving.
Source: The best way to learn math is to learn how to fail productively – Quartz