How do I solve tough programming problems in HackerRank?

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.

  1. First give about 1 hour to the problem, if you are still not able to get any idea, next point.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
By geekycodesco

Leave a Reply

%d bloggers like this: