Getting Started With Competitive Programming

Reading Time: 5 minutes

Hey, are you interested about starting competitive programming?

 

Here might be a Guide or maybe a Motivation of that.

 

Why Competitive Programming?

  • Competitive programming is a mind sport for software/IT industry. Also, it improves problem-solving in an interactive way. It also helps in developing the algorithm for a particular topic. Many tech companies put first round as competitive programming round to filter out candidates. It just helps you get better problem solver. And many data structure and algorithm related questions are asked in interviews. Companies give a direct interview for candidates having excellence in some competitive programming competitions.

 

Here is a guide if you want to start.

 

The Language:

  • You can use any (Programming) language(No HTML it is not a programming language). Just check if it is in ICPC official language or not.
  • But most preferred would be C, C++, JAVA. Sometimes I see people running python code not getting green tick(means all answers right) because of the time limit(python has more run time then C++ or JAVA).
  • But in good competitions, you might not get any kind of problems with that.
  • Google hash code finalist and God of machine learning Andrei Margeloiu say about JAVA: -” It’s slow. But it has Biginteger class, even if there are very few problems that require using it. If the time limit is tight, you will get Time limit exceeded. Java is not accepted in all competitions “ in his article.

Now the choice is yours.

Firstly, write your code like an artist it should be easy to debug by other guy reading your code.

Starting

  • Concrete your basics, do at least 30 problems(for each topic, 50 for arrays), an implementation in any competition you can find one or two problems based upon implementation.
  • For any language basic topics are
    1. Data Types,
    2. Branching,
    3. Looping(For looping practice pattern programming is best),
    4. Time Complexity,
    5. Array(for C,C++),(Highly recommended)
    6. Structures(for C),Classes (JAVA ,C++ or any Object oriented language)
    7. Bit manipulation(Highly recommended)

 

 

 

 

 

Some basic tricks:

You can always put

while(t–)

       {

       }

instead of

for(int i=t;i>=0;i–){…}

 

Some basic algorithms

sorting :(Bubble sort, quick sort, merge sort) implement them by yourself

Searching: linear search, Binary search, Ternary search that to by yourself

 

Now you can start competing for any competition your rank might be low but still you can try to get into the environment.

 

Data Structure:

  • Arrays
  • linked list
  • Trees
  • Graphs
  • Stack
  • Queue

 

Parallelly,

 

  • You can start learning Libraries implementation

 

  • For C++ there are standard template libraries like
    • Vector (mostly used),
    • Map(mostly used),
    • Set(mostly used),
    • Queue,
    • Dequeue,
    • Stack,
    • List(haven’t used it since I learned it).
  • Every language there exists such kind of libraries.

 

Libraries function like sort, find, reverse, gcd, etc are good but better if you practice them before.

For competitions, you can use (preferred by me) :Hackerearth,CodeChef,Codeforces

  • Hackerearth: Good for basics, for a particular topic
  • CodeChef: For ICPC region style competition as well as long style competition 3 per month.
  • Codeforces: Better for good(Efficient) approach at least 6 competitions per month.

Now there are several things to learn like, the efficient algorithm of Tree, Graph(Depth-first search, Breadth-first search) Kadane’s algorithm, Shortest path algorithms for graphs, Segment Tree.

Clearly, all it is sufficient for getting a job but there are more topics.

 

Typing Speed:

  • In CP typing speed can make a difference especially question in easy and everyone knows the approach keep it decent 55 to 60.
  • Do not focus too much on that but that can be a tiebreaker.

 

Competitions:

GOOGLE HASH CODE, ACM ICPC, GOOGLE CODEJAM, CODECHEF SMACKDOWN, and several competitions in hackerearth, codechef, codeforces.

 

GOOGLE HASH CODE: Hash Code is a team programming competition, organized by Google, for students and professionals around the world. You pick your team and programming language and we pick an engineering problem for you to solve. This year’s contest kicks off with an Online Qualification Round, where your team can compete from wherever you’d like, including from one of our Hash Code hubs. Top teams will then be invited to a Google office for the Final Round. More details

 

ACM ICPC (Association for Computing Machinery – International Collegiate Programming Contest) : The ACM ICPC is considered as the “Olympics of Programming Competitions”. It is quite simply, the oldest, largest, and most prestigious programming contest in the world.

More Details

 

Google CODEJAM: Code Jam is Google’s longest running global coding competition, where programmers of all levels put their skills to the test. Competitors work their way through a series of online algorithmic puzzles to earn a spot at the World Finals, all for a chance to win the championship title and $15,000. More details

 

CodeChef SNACKDOWN: SnackDown is a global programming event that invites teams from all over the world to take part in India’s most prestigious multi-round programming competition. Hosted by CodeChef, SnackDown is open to anyone with a knack for programming and began in the year 2009. More details

Monthly

These competitions are held every month on a specific date/week/time. These competitions help you boost your profile on the respective website by ranking you based on your performance.

Long Challenge

  • CodeChef Long Challenge is a 10-day monthly coding contest where you can show off your computer programming skills. The significance being – it gives you enough time to think about a problem, try different ways of attacking the problem, read the concepts etc. If you’re usually slow at solving problems and have ample time at hand, this is ideal for you. CodeChef

Monthly CookOff

  • CodeChef Cook-Off is a two and half hour coding contest where you can show off your computer programming skills. CodeChef

Monthly Easy

  • A 3 hours challenge conducted in the first week of every month. Comprises 6 algorithmic programming problems conducted between 21:30 IST to 00:30 IST. Hackerearth

Monthly Circuits

  • Circuits take place during the third and fourth week of every month. The objective of Monthly Circuits is to challenge the talented and creative minds in competitive programming with some interesting algorithmic problems. The participants will be challenged by Multiple Problem Setters with 8 problems of varying difficulty levels in a duration of 9 days. Hackerearth

 

The Last Lesson:

The last lesson is don’t get demotivated by cp(competitive programming), There can be a case you might won’t show any progress for 3 months. Try as many approaches as you can for a particular problem. And get one thing that CP is not the only thing in computer science if you are not interested in it you can neglect it.

That’s all from my side.

 

Golden Rule:

It is practice, practice, and practice. But don’t give some topic over time.

 

Experience:

I started on 4th December 2017. After eleven months I got the fifth rank in our college with my respective team and first in our year with ICPC rank of 534 in India region. And First rank in 2nd year. And got respected rank held in of CP several competitions held in our college NIT Surat. And it is fun to see your rank above your friend’s in competition and get motivation if his/her rank is better than you.

You can contact me at:

https://www.linkedin.com/in/dhvanil-vadher/

https://www.facebook.com/dhvanil.vadher

WhatsApp: 8780110809

Thanks for your time!!!

CEV - Handout