DEV Community

Cover image for I can't solve problems, what should I do?
Adarsh Navneet Sinha
Adarsh Navneet Sinha

Posted on • Edited on

I can't solve problems, what should I do?

Can you all relate to the above image either while solving tough problems on LeetCode, GeeksforGeeks, some other websites, or working with projects?
Yes, we all are the same and it's the most common doubt among beginners or say codenewbie. I can relate to it and believe me or not it's becomes so demotivating to continue with same. When I was a beginner, thoughts often came to my mind that this programming sort of thing is not made for me, and thought of giving up.
Frustrated and demotivated

After reading so many articles over the internet, I learned the correct way of learning and improving my productivity. Did I give up?
No, remember the most important rule of being a programmer:
Never Give Up
Curious to know what to do in such conditions? Stay in the loop and I will help you with that.
These tips will be useful regardless of whether you are doing development or problem-solving.
But there is a famous rule in programming that says “never copy-paste code that you don’t understand”.
Confused
Confused? I am saying to break into someone's code but never copy them.
Well, you have there are few steps that you have to follow.
First try to understand the logic from it and try to code by yourself, if you can't then follow the below steps.

  1. Type the complete code by looking through it. (yes, yes, I know I just said not to do copy paste and now this, patience, patience).
  2. Make sure that your program or application is functioning as expected, i.e. confirm that block of code really did solve your problem.
  3. Delete the copy and pasted block of code line by line.
  4. Each time you delete a line, check to see what’s been broken. Does the app still run? What are the error codes? What has deleting that line of code done to your program?
  5. Even if you think you know what a line of code does, delete it any way. The most important task as a programmer is to always test your assumptions against the outcome. The most enjoyable feeling as a programmer is for the real world to validate your assumptions. You know how nice it is when your boyfriend/girlfriend/husband/wife says those magical three words. AC 0 Errors or All Testcases Passed or AC or I was right. It’s like that, but better.

By breaking the solution code, line-by-line, you’ll learn and understand what each line does and why it’s been written. This is a far better way to use code from other people than just pasting it in and hoping for the best. Once you understand why each of those lines was necessary, the next time you encounter a similar problem, you’ll be able to tease out the problem and solve it yourself.

You might now probably ask, ok I will follow these tips but how will I know if I have improved or not? What's my progress.

Well for that what you need is to bookmark the question or note down where your code was failing. Once you have took help from any source, come back after some time let's say 2-3 weeks and try to code now by yourself. Still can't? Continue this loop until you can solve without looking to solution.
Confident

This was how I get out of coding ruts.

Feeling confident and motivated now?

Yes, All the very best for your journey.
No? Feel free to reach out to me at my social handles @geeky01adarsh

Let me know your thoughts in the comment box below.
Keep Coding!

Top comments (14)

Collapse
 
resetnak profile image
Alexandr Rešetňak

Thats exactly what I needed!

thoughts often came to my mind that this programming sort of thing is not made for me is exactly my feeling when I get stuck. Thank you for this article! Keep going and happy coding ;) Cheers

Collapse
 
geeky01adarsh profile image
Adarsh Navneet Sinha

Glad you liked it! Happy coding :-) cheers

Collapse
 
darshkul24 profile image
Darsh

Would you like to collab??
I have a team..

Collapse
 
geeky01adarsh profile image
Adarsh Navneet Sinha

I would be happy, if I could. We may have a chat over this.

Collapse
 
darshkul24 profile image
Darsh

It would be good if you have a discord account because a discord server for our is already made..

Thread Thread
 
geeky01adarsh profile image
Adarsh Navneet Sinha

It's Adarsh#7101

Collapse
 
theblackscorpion profile image
Priyanshu-bit

Much needed article 😄

Collapse
 
geeky01adarsh profile image
Adarsh Navneet Sinha

Thanks brother! Glad you liked it😀😊

Collapse
 
ibrahimadesoye profile image
Ibro Makanaki

Nice write up.

Collapse
 
geeky01adarsh profile image
Adarsh Navneet Sinha

Not everyone appreciate by commenting!!! Thank you sir😊

Collapse
 
ffingu profile image
Fionnguala Sherry-Brennan

Thanks for the motivation! I WILL NOT give up :)

Collapse
 
geeky01adarsh profile image
Adarsh Navneet Sinha

Glad you liked it and learned something'😍!!! All the very best for your upcoming journey🥳

Collapse
 
dheerajyadav18 profile image
Dheeraj Yadav

Superb brother ✌️

Collapse
 
geeky01adarsh profile image
Adarsh Navneet Sinha

Thanks brother!!!