This is good advice. But for me, the hours’ struggle is more useful if not contiguous.
I get the best results from struggling with a given problem for no more than 1 hour continuously, and then going away and coming back sometime after my next sleep.
By struggling I mean “not making visible progress” - if progress is happening then just keep rolling.
This sounds like how I approach leetcode. Leetcode feels a bit like math to me anyways. Coding isn't the hard part, understanding the algorithm in conjunction with the data structures is.
Coding is the hard part if you are bad at coding but good at maths and algorithms. Writing accurate code for solving a hard problem in under 30 minutes requires you to be really good at coding.
I get the best results from struggling with a given problem for no more than 1 hour continuously, and then going away and coming back sometime after my next sleep.
By struggling I mean “not making visible progress” - if progress is happening then just keep rolling.