There are many recurring patterns in my programs.
On this page I explain in my own, non-scientific words, why and how I use them.
(TODO: write more, more, more on this page)
The technique I probably use the most is caching:
Whenever a result needs to be computed multiple times and that computation took some time, then I store it in a cache.
Hereby result can be a number, a string or an object. It is stored in a container and accessed via a unique key.
The unique key of an
std::map is its index.
std::map is much more flexible, I try to avoid it due to its lackluster performance compared
This is somehow related to caching:
if a program needs to compute multiple results then it's often more efficient to compute those in some order such that we can re-use results from earlier iterations.
In my opinion, Dynamic Programming can be seen as the reversal of incremental computation.
green problems solve the original Project Euler problem and have a perfect score of 100% at Hackerrank, too.
yellow problems score less than 100% at Hackerrank (but still solve the original problem).
gray problems are already solved but I haven't published my solution yet.
blue problems are already solved and there wasn't a Hackerrank version of it (at the time I solved it) or I didn't care about it because it differed too much.
Please click on a problem's number to open my solution to that problem: