soda_bottle's blog

By soda_bottle, history, 3 years ago, In English

Sometimes, problems have a greedy element associated with them. Once this observation/inference is made we can easily solve the problem using known techniques such as binary search/dynamic programming/brute force etc.
But often times, it is really difficult to prove such observations. We make an intelligent guess for example — "I infer that after all operations have been performed only odd numbers will be left in the array ..." — and kind of have trust that it will work. But, if unable to come up with a proof, people use different techniques such as writing a brute force to observe a pattern, or visualizing etc. to increase certainty of some statement being correct. Or in other times, people might just know the fact from a previous problem. Can people share their experiences in these situations? And workaround methods?

  • Vote: I like it
  • -11
  • Vote: I do not like it