Python for competitive programming

Last night I was participating in CodeChef October Cookoff for the first time. It was a good experience even though I could solve one problem completely & two others partially attempted out of total five.

So, there’s a language debate over which should be better for competitive programming. I natively speak in python though I started off with C/C++ family. So, let’s see some comparison over a brute force solution to a problem written in Python (A slow language) and C++ (A fast language).

Python takes > 5.01 seconds (The limit for python on CodeChef is 5.01s).

cookpy

Now, Even C++ fails to nail the brute force approach (The limit for C++ on CodeChef is 1.01s).

cookcpp

So, the crux of the story is…

Concentrate on the correct Logic / Algorithm to solve rather than a certain specific language.

Though this is for the beginners & of course data structure are heavy with Python but for your own sake learn better algorithms each day.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Design a site like this with WordPress.com
Get started