Is it better to re-implement algorithms and DS or use our own created libraries?

I don’t understand if it is better to create our libraries which I can use again and again in a competitive programming competition or is it better to re-implement them again and again.

Pros for re-implementation:

  1. More practice of implementation of algorithms and DS
  2. Can easily tweak it
  3. Makes a better typer
  4. Can help in interviews

Cons:

  1. Time-consuming even for implementations one knows by heart

Pros for libraries:

  1. Saves time
  2. Teaches how to maintain a huge code base and which one should be used when
  3. Teaches how to modify existing code as per our need without killing its real purpose

Cons:

  1. One might forget implementations

So what are your views and what is better in long run?

1 Like

Create your own library and use in live contests where time matters.
Re-implement them when you are trying some question in practice. In practice you can afford time and brush up your skills.

3 Likes