There are 4 persons who wants to cross the bridge A, B, C and D. but bridge cannot be crossed without the torch because its night time and at a time maximum 2 person can cross the bridge. the problem is to find minimum time required to cross bridge.

- A takes 2 minute to cross the bridge.
- B takes 3 minutes to cross the bridge.
- C takes 4 minutes to cross the bridge.
- D takes 7 minutes to cross the bridge.

Solution :

firstly A and B will cross the bridge with torch(time took 3 minute)

then B will return back with torch(time took 3minute)

then C and D will cross the bridge (time took 7 minute)

the A will return back and cross the bridge with B(time took 5 minute)

**total time took — 18 minute**