HashedIn by Deloitte Interview Question

Bridge and torch problem