First look at writing a Genetic Algorithm

What is a genetic algorithm

A genetic algorithm mimics evolution. The idea is that a possible solution to a problem is encoded in a ‘chromosome’ and the genetic algorithm evolves the chromosome, using mating and mutation, towards a solution.

A much better and detailed explanation here.

Python implementation to the problem here is below.