Usually, when I can’t solve a problem, I either search it up on the net or understand the logic used in AC codes…Could you suggest a better way of how to learn concepts? I am new to programming and only know basics (lists, loops, if-else, I/O)…from where can i learn more advanced stuff like Trees, stacks, etc. Also what is dp(dynamic programming)?
Why is searching bad? An intuitive understanding is the best way to learn things, because it makes sense to you. By searching, you can piece together the details of some algorithm/data structure for yourself and truly understand it.
After solving a particular problem by searching (say, print sum of all nodes of a tree), i can understand the logic and implementation of that problem, but if i face a problem like, find the path from node x to node y such that the sum is maximum or something, i am unable to do it
There is a difference between understanding a topic and recognizing when to apply it. The first is relatively easy: read up on the topic and implement it. The second is much harder and is one of the most important factors in determining how good a competitive programmer is.
The best method to develop this skill is solving a lot of problems. When you couldn’t solve a problem during a contest: read the solution and upsolve it. In short: practice practice practice.
@wicked_knight this happens with me too but I think all the new coders like us need to do practice a lot and checking AC codes doesn’t means that you’re cheating. It sometimes help to learn new concepts.
thank you very much : )
i know it doesn’t, but i feel simply checking a solution and solving is somehow not the best option. I sometimes google the conceptual understanding I have and modify the sample geeksforgeeks type code according to my needs and that feels much better than seeing someone else’s code and just writing it in your own words. But many a times it is not possible to find exactly what you need on such sites.
I agree with you & with that only we can grow.
When I started CP, I solved a lot of questions from leetcode. And I can say that I learnt 90% of C++ stl by seeing other’s submissions. Even if I make an AC, I would go though the solution of a faster submission and see if I can optimize my code.
Bottom line is, referring someone else’s solution definitely helps, but you have to keep these in mind:
- Blindly copying that submission is of no help.
- If the person has used some sort of stl container/algorithm, learn it.
- After going through an AC submission, come up with your own code, and try to think why you had to refer a submission.
a. Was it because they used a new concept that you didn’t know (like DSU or Topological Sort)? Cool. Now learn it and solve similar problems.
b. If it was something that you are completely capable of doing, but you were not able to think in that direction, mark that problem and try to solve it again after a few days.
thanks a lot @aneee004. Most helpful!
Thanks for the help.