Note: Questions you might (not) get the answers to, but you will gain enough clarity get those answers yourself.
- Is competitive programming necessary? How to balance college, programming and other aspects?
- Does language matter? What language to start with? How to approach learning a new language?
- Is development really necessary or we can directly start with competitive programming? What should be my first preference (development or competitive programming)?
Side note: Shoutout to tsecgeeks.in for documenting Dive into Code, my first talk around this topic.
Educating oneself about the difference
- What are we here to do today?
- How many of you have solved at least on CP/DSA problem?
- How many of you have built at least one project using any language?
- !(speaker to audience session)
- A conversation between peers. Feel to answer others’ question if you want to.
- About asking questions.
- What is DSA?
- Data structures: A Data Structure is a way to organize data to allow processing of a large amount of data in a relatively short period of time.
- Algorithm: Algorithms are well-defined sets of instructions designed that are used to solve problems or perform a task.
- What does a DSA problem look like?
- You are given a set of instructions.
- You have to figure out to solve the problem using a specific Data Structure and Algorithm.
- What is competitive programming?
- Poll: What platforms do you know?
- CP is a mind sport just like any other sport.
- There are variables like time, speed and accuracy involved.
- DSA vs CP
- What to do and thinking what to do
- Quick vs Efficient
- code quality
- LL, BST are never used in CP
- Answer to this is very goal specific actually but I try to put my opinion.
- CP: It helps you build a problem solving mindset, improves code reading ability, debugging faster, optimising. (which is essentially what some companies are looking for in interviews.)
- Why competitive programming?
- with developing Problem Solving skills.
- to be a quick thinker.
- to think about efficency in terms of time and memory limits.
- And also, it is a part of recruitment/shortlisting for some companies for full time job roles.
- How do I start?
- Level 1: Learn a language > Learn Standard lib(inbuilt) > Hackerrank
- Level 2: Solve problems
- Level 3: Participate in contests > Practice > Upsolve
- Anatomy of a CP Problem
- Problem Statement
- Input/Output format
- Memory and Time Limits
- Sample Test Cases
- Sample Problem
- Navigating through Codeforces and Hackerrank
- Solving strategy
- Reading the problem and understanding the problem.
- Filter the noise and make observations as you read.
- Connect the dots and do something which you do know
- Don’t jump to the code. Think first.
- Counter intutiveness about the think twice, code once.
- Don’t always optimize. If nothing works, try Brute Force.
- Edge Cases.
- Eg: Write a program to add 2 numbers.
- Contest strategy
- Don’t look at the leaderboard.
- Probably look at the number of submissions.
- Move to the next problem if you have given sufficient time to a problem.
- Come back at it with a fresh perspective.
- Upsolving strategy
- What is Upsolving?
- Do n + 1 th problem from a contest.
- Read others’ code.
- Clean code?
- Better implementation?
- Editorial reading strategy
- Don’t jump to the climax.
- Don’t look at the code directly.
- Go step by step, line by line.
- Try it after each line.
- Even if you look at the code, do not copy paste.
- Let it go if it doesn’t make sense today.
- Don’t take things too personally. It might make sense tomorrow.
Mistakes I made
- Not getting out of my comfort zone.
- Moving to look at others’ solutions quickly.
- Not being consistent.
- Giving up.
- If we take a broader look, and zoom out a little from this scenario — it emulates real time problem solving.
- Reading the problem and understanding it.
- Understanding the requirements.
- Thinking about an approach. (Design)
- Thinking about efficency. (Feasability)
- Coding out the problem. (Development)
- Result of the problem. (Speed, Time, Testing)
Real Time Examples
- Harsh Kapadia’s Git Graph
- React’s Diffing Algorithm
- React’s Source code: Internal packages
Some prestigious contests
How much time to spend on solving a problem?
From where to practice?
How to start practicing?
- Implementation, constructive algo, Ad Hoc and greedy
How to stay consistent
- Start enjoying the work, if you tell yourself consciously after sometime subconsciously you will start enjoying it.
- Make a peer group if 2-3 people who have same goal.
- Hold each other accountable, and keep each others motivated.
- Have short discussions after contest.
- If practice gets boring then start learning any new DS/Algo.
- Have a growth mindset, and take responsibility for yourself.