Author

Paul Gribble

Published

February 6, 2024

Preface

This is a collection of coding challenges and exercises taken from and/or adapted from a number of sources including Project Euler, Advent of Code, and others.

The challenges may be completed using a programming language of your choice including MATLAB, Python, R, or any other language.

You can likely find solutions to some of these challenges on the internet in coding forums, on GitHub, and/or using large language models like ChatGPT or others. I encourage you to resist the urge to immediately search for a solution and copy/paste it.

Instead try to write your own code, by working through the logic of the challenge, and thinking about what data structures, programming paradigms, and algorithms you might use. Sometimes even sketching out the problem on pencil and paper first is a good idea.

For many challenges you might find built-in functions that perform the computations that you need. It’s OK to use these as long as you (a) understand how they work and (b) trust (or verify) that they are correct. Sometimes it is better to code things from scratch. In the long run relying on external libraries can be problematic, as they can change unpredictably and/or introduce unexpected compatibility problems.