Block Interview Question

Very simple algorithm and data structure