Inventia Interview Question

No proper interview, just a coding assignment to solve.