Getting Started with Competitive coding

A quick guide on How to get started with Competitive Coding.

Hello Everyone, NefariousPie here. This blog is for newbies who are learning to program or, for people who are willing to brush up their programming concept. We’re going to discuss some basic tricks and tips. I hope you will be able to see the solutions of different programming problem after this series of blogs.

Quick Notice

This particular blog is for newbies. But you need to have basic knowledge of Programming. If you don’t have any previous knowledge, please learn basics using any programming language like C, C++, Java or Python. And make sure to learn the following concepts.

  • Loops
  • Functions
  • Array
  • Linked List
  • Sorting

Competitive Coding 101

In this section, we are going to talk about some basics things you have to remember for competitive coding. Topics like: Choosing a Programming language, Things you have to learn for Competitive coding, How to practice and “why Competitive coding ?”

Choosing Programming Language

Confused?

There’s a lot of programming languages available in the market. But, not every language is going to provide you with the freedom to code. And also, you can not be comfortable with every language. So choose the language you’re comfortable with and that does not have many restrictions. But you may have to use a different programming language for different kind of problems.

Well, you might be thinking about what programming language I use. My answer is C/C++. The reason is simple. I have been using C for 2.5 years. I am comfortable with this language. And C or C++ is faster than other programming languages like Python or Java. But when I face questions on Strings or have to deal with large integers I use Java.

Basic Things to Learn

Next thing I would like to discuss is the necessary things you have to learn for competitive coding. So, the things I have mentioned before in the list are basically the necessary things you have to learn for competitive coding. But with those basic things you have to learn some algorithms. Divide and Conquer techniques, Dynamic Programming can help you to solve very tough and interesting problems. There are other algorithms like Knapsack, Merge sort, Binary Search, Flood fill Algorithm etc. These Algorithms are really useful to solve different problems.

A new world of competitive coding.

Now, don’t get scared about these terms we’re going to learn them one by one.

How to Practice

Practice makes you perfect and it goes definitely in the field of competitive coding.
Practice practice practice…

Practice Makes a man perfect. You don’t learn to swim by reading books on swimming. We can learn to swim only by getting into the water and practising it. The same thing goes for coding as well. Reading is one thing but the most important thing is to practice. There are different websites to practice for competitive coding. Most popular ones are…

CodinGame is a bit different from the other websites because instead of simply solving coding challenges in an editor, you actually take part in writing the code for games that you play directly online. People interested in gaming are going to love this platform.

First, solve the introductory problems on these websites. You are going to have a basic idea about how to write codes for competitive coding. And we’re also going to discuss ‘How to write code for competitive coding’ as well.

Why competitive coding

Career Preparation

The standard coding interview has much in common with a programming competition. They both require solving a clearly-defined programming puzzle, tend to focus on well-known algorithms rather than domain-specific technologies, and reward quick solutions. Also, during Competitive coding practice, you’re going to learn some new techniques and Algorithms that your curriculum can not provide.

Makes you a team player

Many contests take place at an individual level and many contests involve team participation. You give contest in a group of 2 or 3. So you start to learn how to approach a situation in a group.

Work under pressure

While solving a question in competitive programming, most of the time you get the wrong answer and you face a failure. By solving lots of questions, you will overcome the fear of failure. Competitive Programmers perform under pressure. They take out a solution which builds their real-life problem facing skills in a specific amount of time.

Job opportunity

Coding competitions like Code Gladiators, Code Wizards, TCS Code vita, Hackwithinfy not only provides attractive prizes and money to the winners but also provide them job opportunity in the biggest it farms of India like GE Digital, Verizon, Cognizant, IRIS.

Things you should not do

There are certain things you should not do. Why? Because these things will lead you to be a so-called “Bad Coder”.

Copying and pasting code without Understanding logic

This is a serious problem every beginner tackles. People always tend to go for the easy solution. But an easy solution may lead you to failure in solving problems in the future. let’s talk about a small example. Check whether K-th bit of a number is set or not.

/*This is a code to check whether K-th bit of a number is set or not*/
#include<stdio.h>
#include<stdlib.h>
int isKthBitSet(int n, int k) 
{ 
    if (n & (1 << (k - 1))) 
        return 1;
    else
        return 0; 
}
void main()
{
    isKthBitSet(10,2); /*this gonna check if 2nd bit of 10 is set or not*/
}

If you have not understood the logic behind problem then in future, the only problem you can solve is the problem “check whether K-th bit of a number is set or not”. You can not solve any other related problems. But if you know the logic, you can solve the following problems with this logical understanding.

Check the number of set bits in an Integer.

In an array of integers, determine the Element with the highest/lowest number of set bits.

Decimal (Integer) to Binary conversion. etc.

Participating in Coding Contests without Having Prior Knowledge

Participating in coding contests are good for testing your Competitive coding skills. But doing it without any prior knowledge can lead you to Depression.

A Meme, kind of!
Depression

Even if, you have written the Correct logic the output may show as “Incorrect”; Just because of the presentation error.

But, Don’t worry about that. We have got you covered. We are going to solve this kind of problems in the coming articles of this series.

Until then, Do some digging in the mentioned websites and Don’t forget to give us feedback. And, If you have any question, ask it in the comment section. We’ll be more than happy to help you.

5 thoughts on “Getting Started with Competitive coding”

Leave a Comment

Your email address will not be published. Required fields are marked *