Octopus Energy interview question

COding challenge submitted within a week