mandh_bhudhi_huon_me's blog

By mandh_bhudhi_huon_me, history, 4 years ago, In English

Hello Everyone, I am having trouble with Greedy Technique. Though I can identify if the question is greedy but I am unable to start the solution Please help if you can with your experience it would be much help for coders like me. Thank You!!

| Write comment?
»
4 years ago, # |
Rev. 4   Vote: I like it +13 Vote: I do not like it
  1. Open problemset and search for greedy problems, with solution and rating.
  2. Choose the easy ones 1000-1200
  3. Try to figure out solution, if you failed to do it in 10m, read solution given by author.
  4. Try to implement solution, that you figured out/read. If you failed to do that in 30m, read implementation of autho. Try to understand why it works, and then try to write your own implementation again.
  5. Once you solved 5-6 problems of rank 1400, without looking at solution, you are done. Else return to step 3 with new problem to solve.

Bonus: Try to read and learn algorithms listed here: https://www.geeksforgeeks.org/greedy-algorithms/

»
4 years ago, # |
  Vote: I like it +4 Vote: I do not like it
»
4 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

Adding to the comments, also try solving questions of tag constructive algorithms, it really helps in training your mind to prove your thesis, and most of the time, the solution is simplified to a simple greedy approach.

»
4 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I always had problems with greedy algorithms, I would say that to use them you need that your solution make sense in your head, if it doesn't, I would say to just run away from them.