Coder Social home page Coder Social logo

cc's Introduction

Getting into Competitive Coding

Programming is all about writing code to solve problems or tasks. Competitive programming makes a sport out of this, where contestants compete (usually online) to solve a bunch of such problems in a limited amount of time.

What's in a problem?

Problems are primarily math, logic and/or algorithm based and typically look something like this. Such problems usually consist of a statement (that details the task), the input and output format, constraints on the input and some examples (will be further explained later on).

Try this problem. Read the statement carefully and try to understand what it is asking. Once you figure it out, all that's left is to code.

Here's what one of the many possible solutions looks like.

C++ code
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    while(n--) {
        string s;
        cin >> s;
        if(s.length() <= 10)
            cout << s << endl;
        else
            cout << s.front() << s.length()-2 << s.back() << endl; 
    }
    return 0;
}

Choosing a language

Most competitive programmers prefer C++, and for good reason. However, Java and Python are also fairly popular. Knowing a programming language is the only pre-requisite.

Note: The code snippets in this guide will be in C++ since it is arguably the best language for competitive programming and not because I do not know any other languages :/

Setting up an IDE

If you haven't already set up an IDE, you may find use for one of the following links.
Link to setting up Sublime
Link to VS extension (cph)

Competitive coding platforms

There are many platforms that host programming contests and allow you to practice solving problems, among other things. One such platform is Codeforces, which I primarily recommend and use.

Here is a detailed guide I've written about problem statements, how contests work and the rating system on Codeforces (and a few other platforms).

Get started

Head on over to problemset on Codeforces and sort by rating. Solve some easy problems till you get a feel for it.

What's next?

Once you familiarize yourself with these things, here are some things you could consider doing next:

  • Take a look at time and space complexity, as will you soon realise that not all logically 'correct' solutions pass the given constraints.

  • Learn C++ STL. STL, or Standard Template Library, is a huge library of useful functions. If you're not already familiar with it, this is a good place to start. Try out a few problems here.

  • Develop your problem solving approach by tackling topics one at a time. Here's a collection of some common beginner topics and problems on the same.

  • Turn to the codeforces problemset, and sort by difficulty and tags. Grind problems because there's nothing like practice, practice, practice.

  • Participate in live contests or take virtual ones. Virtual contests are a way to participate in or experience old contests that have happened in the past.

The secret formula Practice
In all seriousness though
Learn new topic > Practice problems > Improve speed > Learn new topic > Practice ... Rinse and repeat.

Extras

Track your progress
Codeforces Practice Tracker
Rating Predictor (Download the extension)

cc's People

Contributors

the-hyp0cr1t3 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.