Why should you learn competitive programming ?

Why should you learn competitive programming ?

Once someone asked me what inspired me to learn competitive programming ? So i just told why i started it ? how it helps you in your career? I saw many found my post very beneficial. So i just thought of sharing that here as well.

Many of us are doing programming job. I can say lot of people find it mundane as they don't want to do it. They say they want to try something different. Few of them say they want to grow as a programmer but they feel it would be very arduous. And then few of them are adept. Have you ever thought how they reached there? How they made it easily? The answers is simple they are doing what they love to do. They don't feel like working.

Writing solution to given problem is not very big task but how good your code is in terms of space complexity, time complexity. How it behaves with large input size, small input size, best case, worst case, average and various other aspects. If i am not aware of those, i can not write optimized solution to given problems or any feature which i am going to add to my application. There are various sorting algorithms available, but you can not use same sorting everywhere. Insertions sort is good for sorting small arrays, it has o(n*n) time complexity, but i can't use it for large input size. Quick sort is most popular sorting algorithm. Its inner loop is very short and can be optimized very well. We also should think about additional space. Do i need in place sort? There are many aspects which you should keep in mind. We will take one more example: perform reverse on given array

Now just think how you can achieve it in best way without scrolling down. You should come up with the solution which perform less number of operations. I know many of us might say that just create one more array, and start copying characters from the last, or just start printing characters from the last. But do you think you can optimize it? Here, you don't need to iterate full string, you can achieve it by iterating only half elements of given string and perform swap operation.(i with n-i-1) We just looked at few examples which basically tells us that if you are aware of these aspects, you can write best code to given problem.

Now i am going to tell how i started it. I got rejected by one of my dream company few years back as i was not able to answer few algorithms questions. I felt bad that time, and started learning data structure and algorithms. I used to solve 3–4 problems on hacker rank everyday. And soon i reached to algorithms level 3 with percentile 70+. So i think, you will not see your best unless you see your worst today. That worked for me as an inspiration.

I had basic knowledge of data structure and algorithms that times. But you know if you don’t apply your knowledge to various problems, you can’t achieve anything. I started with Cracking the coding interview book, used to solve warm up, implementation, string questions on hacker rank . We need to keep one thing in mind while learning. Though we don’t feel any difficulty while solving easy problems, we can learn a lot by looking at others’ solution, analyzing different different solutions. And trust me these few approaches which you can learn with simple problems, will help you a lot in solving difficult problems in future. That was my strategy for learning competitive programming. As you move forward you will be able to write solution faster and with good time/space complexity.

Few resources which can help you :

  1. There are many good books on algorithms, i would suggest Cracking the Coding Interview book.
  2. Start with hacker rank problems Hacker Rank (start with easy one)
  3. Top coder - Data Science Tutorials
  4. Interview Bit
  5. Keep checking stack overflow data structure/ algorithms tag - Newest 'data-structures' Questions (You will find many new questions here, try to answer those, try to understand others’ answer.)
  6. Code chef Data Structures and Algorithms
  7. Problem Solving with Algorithms and Data Structures using Python
  8. CMU algorithms wiki


I think you can not be pro at anything unless you love it. As a programmer love your job, love your work and be perfect at your work.

You should learn data structure and algorithms, it changes the way you write code or approach any problem.

要查看或添加评论,请登录

Bhagwati Malav的更多文章

  • System Design lessons learned from Apache Kafka

    System Design lessons learned from Apache Kafka

    This article would focus on various design concepts eg: horizontal scaling, vertical scaling, data sharding…

  • An introduction to Generic Web Data Extraction

    An introduction to Generic Web Data Extraction

    Data extraction play vital role in many applications. Web crawling can help in getting data from various sources.

  • Need of messaging queue in Microservices Architecture

    Need of messaging queue in Microservices Architecture

    In my last article, i wrote about “microservices vs monolithic architecture” which emphasis on advantage of using…

    4 条评论
  • Microservices vs Monolithic architecture

    Microservices vs Monolithic architecture

    Microservices architecture is getting lot of attention these day and being used by Uber, Netflix, Linkedin and many…

  • Programming is beyond learning the syntax

    Programming is beyond learning the syntax

    As a programmer, you should know about programming libraries you use in your applications. It doesn’t matter you are…

  • Don’t forget yourself

    Don’t forget yourself

    We all are living with our hobbies, interests.We all have a penchant for something like one loves to go on a bike trip,…

    6 条评论
  • Love your failures, Success is on the way

    Love your failures, Success is on the way

    How is your life going on? Are you working on something? Are you wary of your result ? Are you scared of your next…

  • Who are you ?

    Who are you ?

    What is the meaning of Life ? what are we running after ? What do we want to accomplish in our life? Have you ever come…

    2 条评论

社区洞察

其他会员也浏览了