A beginner's guide to Competitive Programming

By Shashank Kumar & Snehil Verma

https://slides.com/realslimshanky/comppro

Problem with beginners

How to approach?

Time Limit

Run Time Error

Wrong Answer

The Problem Statement

How to approach the problem statement?
Read the problem statement carefully and try to convert it into the mathematical form and focus only on the parts which are important to solve the question

The Problem Statement

Example - Colleen is turning N years old! Therefore, she has N candles of various heights on her cake, and candle i has height Hi. Because the taller candles tower over the shorter ones, Colleen can only blow out the tallest candles.

The Problem Statement

Given the height Hi for each individual candle, find and print the number of candles she can successfully blow out.

I/O Format & Constraints

Input Format

The first line contains a single integer, N, denoting the number of candles on the cake.
The second line contains N space-separated integers, where each integer i describes the height of candle i.

I/O Format & Constraints

Constraints

1 <= N <= 10^5

1 <= Hi <= 10^7

I/O Format & Constraints

Output Format

Print the number of candles Colleen blows out on a new line.

The Simple Test Case

Sample Input

4
3 2 1 3

Sample Output

2

The Simple Test Case

3

2

1

3

Link to question

Your Solution

Firstly, try to solve just like you imagined the problem without caring much about complexity

Once you have a solution, optimise it if needed depending upon the given constraints.

Past Problem from CodeVita

Checkout the following links for some problems

2014

2016

Practice Problems

Platform to Learn

Some great platforms to get the best.

Interactive Python

Platform to Practice

Some great platforms to practice.

Hacker Rank

Competitive Programming Contests 

This is where you shine.

ACM ICPC - Olympics of Programming

Facebook's Hacker Cup

ICO - Indian Computing Olympiad

The Olympics of Programming

Association for Computing Machinery​

International Collegiate Programming Contest

Prize Money -  $12,000

Go For Gold by Code Chef

Thank You

Shashank Kumar

abc@shanky.xyz

@realslimshanky

Snehil Verma

vsnehil92@gmail.com

@vsnehil92

A beginner's guide to Competitive Programming

By Shashank Kumar

A beginner's guide to Competitive Programming

  • 1,137
Loading comments...

More from Shashank Kumar