Compute minimax grid path and network delay | Google Interview Question