I find that to be the best balance between challenge and learning something new. You will mentally burn yourself out if you keep bashing against the wall for hours or more, not quite a healthy thing to do :)
Meanwhile, people who actually try to compete on this stuff have already developed rich library of specialized algorithms to leap ahead of average programmer. Well, I guess nowadays a lot of it is LLM assisted too.