I can't solve problems, what should I do?
Tags: beginners, productivity, motivation, codenewbie
Published: 2021-08-31 07:56:59

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/elyp9yf80z8w3syoeccg.jpg)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/75odud4k4y1ta6at0dx0.jpg)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zfufaqa238qzub9wxyen.jpg)
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.
<br>
![AC](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56l7fme9hql9vcwzjk91.png)
*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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1j5jz3p1ydw8je4vfnij.jpg)

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](https://linktr.ee/geeky01adarsh)

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