Surya Software interview question

The Bridge and torch problem