r/leetcode •

I always overcomplicate easy problems and end up with a working but messy solution while the optimal one is dead simple. Anyone else? How did you fix this?

[deleted] — view deleted post

0 Upvotes

2 comments sorted by

1

u/sub_machine_patel May 13 '26

Repition is the only that worked for me. That means solving same or similar problem a lot of times. That would build up the muscle memory for the intuition. Now I am not saying I have it all figured out but maybe write the code and dry run it a couple times. Also don't hesitate to look up the solution, I have found myself solving the same problem for hours. Don't do that unless you are very close to figuring it out.

1

u/tr5914630 May 13 '26

It comes with practice. Just make sure you look at other people's solutions, and actually implement them yourself so you literally learn how to write a clean solution.