r/learnprogramming • u/dhananjai_31 • 3d ago
How to improve logical thinking in programming
Hey
I'm 23m working professional,
Yesterday at the office my team lead said he found a pattern in my work
He said I'm mugging up patterns and not thinking logically.
Well I do codeforces , leetcode, hacker rank to improve my programming skills but I understood that he was right
All I do is find a pattern in the problem and try to solve it
Anytime I find a new problem I'm stuck
Because I never saw that before
How to come up with my own solution?? How to improve problem solving and logical thinking???
Open to all the suggestions:)
139
Upvotes
View all comments
1
u/ruat_caelum 3d ago
The long answer is "baby steps"
I'm at point A I need to get to Point Z. I know those two points. What step can I take from A OR what step can I work backwards from Z to bridge that gap.
Keep in mind that because you can't (at that time) visualize a full path you will make partial paths that don't work and have to back track.
Eventually you come up with some path A, J, R, S, T, W, Y, Z
Then you have to evaluate it for Good-in-good-out. Will it PROVABLY produce good results if you give it good inputs.
What is a "Good input" (list them out) and what assumptions are you making about them. E.g. "person's name" is a good input but the assumption is that they only have a "first + middle + last" name and not more, which many people do in non-western countries.
Then make sure you reject any input that "isn't good" and document what assumptions / checks / assertions you are making.
Then you refine the path.
Is your R,S,T block some sort of data handling you can offload to a more efficient native data structure? etc.