5 Tips To Get The Most Out Of Coding Exercises
Tags: webdev, codenewbie, tutorial, beginners
Published: 2020-01-06 12:29:45

**1.Start By Finding The Algorithm** 

The best way in my opinion to approach a coding exercise is to:  

- Start reading the problem instructions and examples, in case there is some, if not take a look at the sample test cases to get a crystal clear idea about what you should achieve, keeping in mind that you should make a solution to solve all test cases, not just the sample tests.  

- Next, try to figure out what steps you need to follow to solve the given problem, these steps should give a correct solution to the exercise and they should be a finite number, thus you will have an algorithm to solve your exercise, Afterwards, you need to transform your algorithm to code using your preferred programming language.

<!-- ![Sketch image from idea to a solution](https://thepracticaldev.s3.amazonaws.com/i/iv8xbbaj9obljmww7640.jpg) -->
<div style="text-align:center">
<img src="https://thepracticaldev.s3.amazonaws.com/i/iv8xbbaj9obljmww7640.jpg" style="width:50%;">
</div>

**2.Simplify & Improve The Solution**

After you come up with a working solution for your given problem, analyze it so that you can find other ways to solve it, often a second solution will be simple and straightforward compared to the first attempt, otherwise, you can try to make some adjustments to your code, such as using the best possible data structures, or maybe remove unnecessary variables, avoid using nested loops if possible, you got the point, enhance your code.


**3.Respect Your Programming Language Principles**

>"Code that gets the job done is not your target"

After you decide which solution is the best for the challenge and writing a working code that passes all the tests, try to respect the programming language standards and best practices. For example:  

- Change the variables names to meaning full names, respecting the naming conventions.
- If your programming language of choice works best with recursion try implementing it if possible, if not try to avoid recursion.
- Try your best to comment your code in order to give other developers some hints about your code.  
- Refer to the documentation as much as possible to expand your knowledge of the programming language used


**4.Try a Variety of Solutions & Exercises**

Sticking with one way of solving problems will stop you from excelling in other areas in your programming language, try solving the problem using different approaches, such as functional programming, object-oriented programing, dynamic programming.  
On top of that, try to find exercises that cover many aspects of a programming language such as exercises to practice arrays, dictionaries, other ones for sets, etc...  
Moreover, you can explore the most used libraries to get familiar with how they get the job done easier.

<!-- ![Sketch image from idea to a solution](https://thepracticaldev.s3.amazonaws.com/i/nz2pk8bej1jeo6ynxe45.jpg) -->
<div style="text-align:center">
<img src="https://thepracticaldev.s3.amazonaws.com/i/nz2pk8bej1jeo6ynxe45.jpg" style="width:50%;">
</div>

**5.Practice Everyday**

>"Practice makes perfect"  

This is definitely true in the coding field as well, dedicating some time to play around with such exercises will benefit you in the long run.  

From this point, you can move to full-fledged projects to use all the techniques you have accumulated in your coding challenges journey.

This is my modest badge in Codewars Kyu4, trying to improve it 👻  

<img src="https://www.codewars.com/users/adn.codez/badges/large">