Introduction to Programming Challenges
Learn algorithms with the help of two simple programming challenges.
We'll cover the following
Chapter goal
This chapter will discuss two simple programming challenges and walk you through a step-by-step process of solving them. We will encounter several common pitfalls and show you how to fix them.
Below is a brief overview of what it takes to solve a programming challenge in four steps:
-
Reading the problem statement: The problem statement specifies the input-output format and the constraints for the input data, as well as time and memory limits. The goal is to implement a fast program that solves the problem and works within the time and memory limits.
-
Designing an algorithm: When the problem statement is clear, start designing an algorithm, and don’t forget to prove that it works correctly.
-
Implementing an algorithm: After developing an algorithm, implement it in a programming language of choice.
-
Testing and debugging the program: Testing is the art of revealing bugs. Debugging is the art of exterminating bugs. Once the program is ready, start testing it. If a bug is found, fix it and test again.
We’ll be solving the following two problems in this chapter:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.