Difficulty Level Easy Asked In Amazon, Adobe, Hike Three solutions Discussed Brute force approach — Using two nested loops Using extra space — Using…
Competitive Programming is a programming sport involving many participants competing with each other to achieve better results. It helps enhance one’s mind and develop analytical and thinking skills. Competitive Programming is more common now than ever before. There is currently an active, competitive online community of programmers and a variety of competitions take place every week. At the same time, competition difficulties are rising.
The first step to getting started with competitive programming is to learn a programming language. If you already have a preference, any language would do. If you have just started learning a new language, C, C++, or Java are the most recommended languages as most problems are set, keeping in mind these languages. The reason is that time of execution is a critical factor in Competitive Programming. Choosing a language whose time of execution is fast is sure to give you an advantage.
If you know C, it is effortless to get started with C++. It is recommended to shift from C to C++ because of C++ features compared to C.
You do not need to know advanced concepts, like classes or generics/templates. You should know if/else, loops, arrays, functions and have some familiarity with the standard library, like math functions, string/array operations, and input/output.
The number of platforms that support competitive programming is increasing day by day. There are lots of great platforms that you can choose from to get started with. We would recommend starting with HackerRank and Atcoder (Beginner). It has the most beginner-friendly interface, IDE, and suitable problems to learn and develop fundamental problem-solving skills and master the languages. Other highly recommended platforms are:
Problem Solving: Start with Basic ProblemsStarting your quest by solving simple problems such as finding a prime number, the number of factors of a number, the number of digits in a given number, searching a number in an array, basic problems using loops, functions, and string, etc. These types of problems can be found in HackerRank as recommended.
These problems might seem simple, but constantly practicing these problems at the beginning of your journey will improve your speed, thinking, and develop an essential skill of writing error-free code.
To move forward as a competitive programmer, Data Structures and Algorithms will be your long-term partner who will help you solve problems with low time and space complexities.
Time Complexity: The time complexity of an algorithm is the algorithm’s amount of time to complete its process as a function of its input length, n. The time complexity of an algorithm is commonly expressed using asymptotic notations:
Space Complexity: The space complexity of an algorithm is the amount of space (or memory) taken by the algorithm to run as a function of its input length, n. Space complexity includes both auxiliary space (the temporary or extra space used by the algorithm while it is being executed.) and space used by the input. An algorithm’s space complexity is commonly expressed using Big O (O(n)) notation.
These two will play a crucial role in deciding the solution’s verdict when doing Competitive Programming. This is where Data Structures and Algorithms comes into play.
Data Structure is a way to store and organize data so that it can be used efficiently. While solving a problem, knowing which data structures to use can make a significant change in time complexities and decide your solution’s fate.
Some Important Data Structures to learn:
An algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces a value or set of values as output. Knowledge of some well-known algorithms can help you enhance your problem solving approaches, find patterns, and solve challenging problems.
Some well know algorithms:
Many of us make the common mistake of solving many problems and not giving enough time to learn new concepts. It is essential to constantly learn and also revise programming concepts such as data structures and algorithms. It is recommend following a simple rule:
For every 3 hours of problem-solving, allocate at least an hour to learn concepts.
In Competitive Programming, it is crucial to be consistent and constantly keep solving problems daily.
When practicing, sometimes, you will not be able to solve problems. In these situations, Do not give yourself up quickly! Continue to try! However, sometimes, we are not able to solve it even after struggling for hours. It is advisable to look at the editorials in those situations. Step-by-step editorials clarify how to solve a problem. You will also learn new and creative ways to solve problems by reading them. So often, even though you have been able to solve a problem, you should read editorials. Also, sometimes you should look at other codes. It also helps you find new ways to solve problems.
Competitive Programming is much fun when you involve your friends. Continually participating in contests with your friends and discussing different approaches will keep you motivated and pumped up always.
Once you understand the techniques of solving the problem and become quite familiar with the language and problem solving, it is highly recommended to start participating in contests on platforms such as Codeforces, CodeChef, or LeetCode.
As a competitive programmer, one can aspire to participate and win global level challenges and represent your college/country. These competitions allow young talented programmers to measure their capabilities and compare themselves with other programmers worldwide.
These are some recommended books to learn Data Structures and Algorithms:
Difficulty Level Easy Asked In Amazon, Adobe, Hike Three solutions Discussed Brute force approach — Using two nested loops Using extra space — Using…
Algorithms have a long history, and the word can be traced back to the 9th century. At this time, the Persian mathematician Abdullah Muhammad bin Musa…
What is Algorithmic Thinking? Algorithmic Thinking has recently become a buzzword among programmers. It is a method for solving problems based on a…
Subscribe to get free weekly content on DSA, Machine Learning and System Design. Content will be delivered every Monday.