If you are a beginner then go with easy problems first, try to solve as much you can for getting confidence. If, you are not able to solve easy problems then spend some time on that try to think harder, even you can’t solve the problem go for editorial read the approach, don’t read the code and try to solve your own spend time and practice gives you high return for sure. If you think you can solve easy problems go for a medium one. Go with the same approach as you have done with easy problems…even giving more time to solve medium ones. Then, hard ones …if you get demotivated solving hard ones …remember one thing 1 hard problem equals 10 easy problems …so be motivated and keep focusing on the goal. At last, I want to say that coding is fun …so keep focusing .. you get addicted to coding after 10–15 days.
You should approach the problem step by step.
- First give about 1 hour to the problem, if you are still not able to get any idea, next point.
- Check the topic tag(DP, Graph, Greedy) of the problem, if you already have the knowledge of the topic and also practiced some easy problems on that topic go ahead with the problem.
- If you don’t have knowledge on the topic, first read a few blogs of the topics and also solve some easy-medium problem to get some idea.
- Next step, is to read the problem and analyze if you have ever solved a similar problem. Most probably it would be a variation of a standard problem.
- Still getting no idea. Its time to head to the editorial. Just read only a small portion till you get a new idea from it. Continue to think rest of the solution yourself. Still..no idea, read another portion, continue in a similar way.
- After reading the editorial, it is must to write the complete solution and submit it. Some people just know the logic and don’t write the code, which is bad.
- Finally, take a look at the code of some of the good coders (aka Red Coders) to see if your code could have been more efficient and shorter.