dholakpur_wala_raju's blog

By dholakpur_wala_raju, history, 11 months ago, In English

A genuine question to all problem setters: why do most of the questions have $$$1$$$-based indexing and not $$$0$$$-based indexing (for instance, permutations, $$$[l,r]$$$ range queries, graph nodes are mostly $$$1$$$ to $$$n$$$ instead of $$$0$$$ to $$$n-1$$$. In my humble opinion, having $$$0$$$-based indexing just helps in writing a much cleaner code i.e. a slightly simplified implementation, like I can create an array of length $$$n$$$ instead of $$$n+1$$$, since computer uses $$$0$$$-based indexing and hence $$$1$$$-based indexing adds an unnecessary offset of $$$1$$$. This offset is most likely not the intention of the problem setter to judge the contestant on his/her problem-solving skills. However, I will mention that $$$1$$$-based indexing looks cleaner to human eyes but with respect to programming perspective, I really don't see any point other than missing it and getting an unnecessary WA.

Full text and comments »

  • Vote: I like it
  • +73
  • Vote: I do not like it

By dholakpur_wala_raju, history, 19 months ago, In English

Everyday people want to know how to become red. They will visit YouTube, LinkedIn, Codeforces and such other sites to find the answer but the hunt still continues. Hence, I will provide the solution for once and for all.

Step 1: Practice. Solve problems and give contests.

Step 2: Stop reading and watching tips. There is no magic. The answer is Step 1.

Full text and comments »

  • Vote: I like it
  • +36
  • Vote: I do not like it