Google Interview Question

Difficult competitive programming as a competition