Coding is just a part of process of problem solving, You should need to understand the underlying problem and efficient solution within given constraint. So i will better tell you,how to be better at problem solving:
Programming Language & Computer science fundamental :-
First
& foremost ,you should be proficient in any one of the popular
languages(C/C++/Java/Python), I will advise you to chose between c++ or
Java ,since both are widely accepted across all coding competitions and
have better resources to get yourself trained. Apart from knowing the
language
make sure you are pretty good in debugging and testing your own written code
with all the scenarios.
Resources:-
CS106A: Programming Methodologies (Stanford Java tutorial)
Eclipse And Java Video Tutorials
CodingBat Java (Elementary problem on java programming to kick start the things)
Coursera (C++ course )
Buy The C++ Programming Language (Bjarne Stroustrup)
Page on stanford.edu( CS101 course by stanford university for non cs students/beginner computer science student)
Data Structure and Algorithm:-
You
can be a good programmer if you know a programming language well but to
become a great programmer you need to understand underlying data
structure and algorithm.
Resources:-
Introduction to Algorithms Book(CLRS) ,easy language,very detailed explanation about each and every algorithm technique(bible book :) )
The Art of Computer Programming: Fundamental Algorithms v. 1 Book
YouTube Channel:-
Coursera(Algorithm course offered by Stanford university)
Do‘s:-
1. Try to implement every solution on paper first before starting the code
2.
Analyze the problem, define the constraint , compare your own solution
with the parameter of time/space complexities and then start coding
(It may be hard to do at first but it will surely make you a better
programmer)
At this point of time you would be pretty confident
enough to imagine ,which technique shall i follow or which algorithm
shall i utilize to solve a particular problem, Now it‘s Practice Time!!!
1. Start solving problem on Sphere Online Judge (SPOJ) ,200 problems
2. Once you finish step 1, try topcoder problems for DP and other algorithmic techniques ( solve around 300 div2 or div1 ,until you feel confident in yourself)
3(Optional) If you are looking for interview preparation ,Start solving problems from
Cracking the Coding Interview: 150 Programming Questions and Solutions
GeeksforGeeks - A computer science portal for geeks
Bottom Line:- It‘s not the only "The"
way to achieve a good programming mindset but it‘s a better way that
helped me to equip myself with better programming knowledge.