It’s been a month or so since I started competitive programming. I am taking it step by step. I want to cover basics at first then move on to intermediate problems.
I’v solved some 9-10 easy implementation problems at Hackerrank. I can say that I can solve problems that require operations on arrays. Now, I want to make the next move. I want to learn further topics. I started searching problems on Hackerrank but they require strong hold on basics.
I just want to know how should I proceed further. Where should I be practicing? Some people say Spoj is the best place where others say Hackerrank. Please guide me here the best place to go such that I can clear my basics and build a strong foundation.
Have you searched the forums first? Such type of questions have been answered a lot. Please try searching with keyword “tutorials” and you will get a lot of similar threads.
Although this type of questions are asked a lot, i feel there is also a feel of “specificity” in this question (quite specific to author) So i wont close it atm [opinion of other users requested].
Firstly, as i said, try surfing around the discuss forums. Such questions have been asked a lot, and you will find a lot of decent answers if you give some time for searching.
Some good answers to guide you even for further steps, and tell you how to approach competitive coding are-
Secondly, you need to give some more details about your current situation. Did you solve 9 problems in a month?
You should atleast complete ALL the easy portion of implementation of hackerrank, before you proceed. For this, you should know upto Strings, arrays and functions. From then, you get lots of choices.
Either you can go learn 2-D arrays after arrays. Or you can learn recursion after functions are clear. After good grasp on 2-D array, array and recursion you can decide if you want to try out “Greedy” algorithm, or learn dynamic programming &etc.
From what i can decipher from your description is that you have done till arrays, which is good but still less. You need to do more. Also, you didn’t mention which language you use? Is it Java? Is it C++? Are you aware of all the in-built functions in it, Eg- You have an inbuilt function in java/C++ to sort an array (you just have to call it, like functions in string.)
You need to hold a good grasp on what your language offers, as well as get yourself acquainted with algorithm questions.
Whether to solve in SPOJ or other sites…depends. I say, stick on 1-2 sites and do them fully. And i feel you aren’t into contests yet. If you are done till array and strings, its time that you start participating in hackerrank’s contest like Week of Code etc. and solve the easy problems. It will show you where you stand, and how useful your practicing is turning out to be. Then you can better decide which direction you should head. Eg- If you are able to handle dp but graph questions are going voer your head, you know which thing you have to tackle next.
Also, Hackerrank has language specific tutorials etc. Did you try them? Did you try that 30 days of code tutorial? Get back to us with more details on your current situation in case you need more guidance.
I am also bit confused as which topic should i learn DP or graph I am facing difficulty to understand both the topics. Can you plz guide me @vijju123
Thanks
If you want to do good in contest, start by learning basic DP (LIS, LCS etc) from geeksforgeeks.org . DP is asked in almost every contest, more frequently than graph theory at times.
Hi,
To perform well in programming contests you have to practice a lot.
I would recommend you to practice on websites which have good editorials like Codechef, Hackerrank, Topcoder and Hackerearth.
You can also see other coders solution to learn better coding practices etc on these websites.
All the four websites have category of problems like DP, Greedy, Graph etc. You can solve them category wise and refer Geeks for geeks side by side to cover topics. This way you will get strong hold of basics.
Also take part in all programming contests on the sites, while learning.
After doing above steps you would be able to handle Easy and Easy - Medium problems on sites.
After getting the basics right go for Medium level problem on Codechef, Div 1 on Topcoder etc. to improve your skills further.
Thanks
@vijju123 thanks for replying. I use C++ as my language, I tried week of code too… I Solved somewhere around 10 problems there… I guess I should solve more implementation problems and then move on to next one’s. Also should I solve entire of Week of code? Also could you tell me after implementation part, what should be my next steps?
Make sure you solve atleast 60-80% of the “Basic Programming” Section. During this, your aim should be to develop skills related to thinking correct approach, and debugging. When you get a WA, try to run against custom test cases to see where the code fails. Only when you give up, take a look at their case and find reason for error. Positively work on debugging part (finding cases where code fails), it will help you a lot when you move to tougher parts.
After implementation, you can try strings (Q are matching with implementation, except that now its mostly characters instead of numbers), or try bits manipulation (after reading basic theory of XOR, & and other operators. Sometimes the contest questions require you to know BIT manipulation as a pre-requisite. You may not get direct Q on it much, but its asked a lot indirectly, in combination with other concepts).
Should you love practicing on pure arrays, go for searching/sorting, or Greedy if you loved solving implementation type of array problems (Since many of sorting/searching Q are tutorial-types, and lack ‘flavour/amusement’ of story type of problem statements)
Before getting to dp, make sure you know a little concept of greedy, so that you are able to appreciate the contrast and difference between them.
There is alot of options, the thing which would best guide you in what section to follow is your interest in it. Try practicing ~3-4 problems each section, and see which one interests you the most. Solve that secton devotionally, and then move to next.
What i did though, was that i immediately jumped to contest after implementation, and then solved sections according to “Ok, which concept i dont know (due to which i couldnt solve that problem on contest)”.
You can try that as well, because the determination to learn is fuelled after being unable to solve the contest problem.
Before jumping to medium problems of any section, make sure you have covered the following-
-Arrays (almost perfect)
-Knowledge of inbuilt functions like sort() etc.
-Strings and its functions
-Basic DP, a feel of its working and thinking process (atleast iterative approach)
Remember, Medium problems involve multiple concepts at once. So if you think that by only knowledge of string and functions, you will be able to complete that section, then its wrong. There are ALOT OF medium/hard Q which require knowledge of dp+ string for instance.
Also, codechef is going to have its long contest in a few days. Participate positively in it. Long contests are best as you have got a LOT of time to think, learn the concept and solve the problem. Check the problems. Its fine if you cant solve it optimally for full score, atleast try for partial. Its a slow process, taking baby steps. Once you start, you will feel a difference after some time. And yes, you will feel HIGHLY ecstatic when you solve a problem (which you were initially unable to) after looking up its concepts on net/referring to guide or tutorials. It makes you use the resources available to you (something which we often ignore).
For now, i will suggest that you go as-
- Implementation (almost all easy done)
- ~4 Easy Q of BIT Manipulation to have a feel. Aim should be to know about “<<” “>>” “^” “&” “!” operators.
- Strings (~70% easy Q)
- 3-4 Q on Greedy
- Jump to geeksforgeeks.org and start dp.
This should let you solve all the easy problems in contest, and occasionally give a try at medium category as well. Feel free to change the sequence/topics according to which topics you like the most.
Its ok to spend more time and practice the topics to your liking, just keep in mind that in the end you need to know a variety of concepts to top the Leaderboard. Positively participate in contest, especially Long ones. You will learn much more concepts in contest problems.
In case you feel confused anywhere, anytime , or need recommendation on type of Q to solve, or need my help in some problem, then feel free to mail me (my email is at my main profile page). Also, we all at coechef would love to help you and show our perspective in case you feel the need of it
Solving entire week of code…Its frankly upto you. The concepts, you will anyway encounter later in practice problems. Its upto you if you want to deal with them now in tutorial, or at a later stage in a problem statement. See what things its teaching, and go back when you feel the need to know further about that concept. But solve till 2-D array at least.
@vijju123 As always, very well written answer!.. Bro, can you tell me if the problems mentioned here are worth solving? https://www.commonlounge.com/discussion/5d2822257dfa49328d85fd27cf114441/main
If you are comfortable with their syntax/style then go for it. I see they have prepared the list very thoroughly. I will advise STICK to deadlines, dont procrastinate. Since summer vacations are round the corner, if you utilise them well, you can complete it in less than 2 months. In case you get a specific doubt you can always mail the link/code to me, i will try my ebst to help you. (Not sure about graphs though, havent started yet. )
Solution to all your problems is here my friend
https://discuss.codechef.com/questions/97760/how-to-become-yellowred-on-codechef-codeforces-in-just-few-months