# Fuse on Fire

Source: https://www.techinterview.org/post/526289631/fuse-on-fire/
Updated: 2026-04-16 · techinterview.org

A mad bomber is out on the job, making bombs. he has two fuses (pieces of string) of varying thickness which each burn for 30 seconds. unfortunately he wants this bomb to go off in 45 seconds. he can’t cut the one fuse in half because the fuses are different thicknesses and he can’t be sure how long it will burn. how can he arrange the fuses to make his bomb go off at the right time?

### Solution

light both ends of one of the fuses. when that fuse goes out, 15 seconds has elapsed. then light the other fuse.

## 2026 Update: Measuring Time with Fuses — Optimal Information Extraction

The fuse puzzle is a variant of the burning rope problem: use non-uniform fuses (each burns in exactly T minutes) to measure specific time intervals. Key insight: lighting from both ends halves burn time.


```
def achievable_times_two_fuses(T=60):
    """
    What times can we measure exactly with 2 fuses of duration T each?
    Using combinations of:
    - Light one end (burns in T)
    - Light both ends simultaneously (burns in T/2)
    - Light second fuse when first finishes
    """
    times = set()

    # Case 1: One fuse from one end = T
    times.add(T)

    # Case 2: One fuse from both ends = T/2
    times.add(T / 2)

    # Case 3: Two fuses sequential, both from one end = 2T
    times.add(2 * T)

    # Case 4: Fuse A both ends (done at T/2), at that moment light Fuse B both ends
    # → Fuse B done at T/2 + T/2 = T (same)

    # Case 5: Fuse A one end AND Fuse B both ends simultaneously at t=0
    # Fuse B done at T/2, at that moment light other end of Fuse A
    # Fuse A has T/2 remaining but now burning from both ends → T/4 more
    # Total: T/2 + T/4 = 3T/4
    times.add(3 * T / 4)

    # Case 6: THE CLASSIC — Fuse A both ends, Fuse B one end simultaneously
    # Fuse A done at T/2, then light other end of B (B has T/2 remaining)
    # T/2 remaining one-ended → T/4 from both ends
    # Total: T/2 + T/4 = 3T/4 ... wait, that's same as case 5

    # The classic 45-minute solution (T=60):
    # t=0: Light Fuse A from both ends AND Fuse B from one end
    # t=30: Fuse A done. Light other end of Fuse B
    # t=45: Fuse B done. Elapsed = 45 minutes
    times.add(T / 2 + T / 4)  # = 3T/4 = 45 when T=60

    return sorted(times)

# Demonstrate the 45-minute measurement
def explain_45_min():
    T = 60
    t = 0
    print(f"t={t}: Light Fuse A (both ends) + Fuse B (one end)")
    t += T / 2  # Fuse A burns out
    print(f"t={t}: Fuse A done. Light other end of Fuse B.")
    t += (T / 2) / 2  # Fuse B remaining half, now burning from both ends
    print(f"t={t}: Fuse B done. Measured time = {t} minutes")

explain_45_min()

# General: achievable times with n fuses of equal length T
# = all values of form k/2^m * T where 0 <= k <= 2^m
# With 1 fuse: T, T/2
# With 2 fuses: T, T/2, T/4, 3T/4, 3T/2 (limited by sequencing)

times = achievable_times_two_fuses(60)
print(f"nAchievable times with 2 fuses of 60 min: {times}")
```

**Generalization and interview insight:** With n fuses of equal length T, achievable times form a set of dyadic rationals (multiples of T/2^k for various k). The puzzle becomes an optimization problem: minimize the number of "lighting operations" needed to measure a target time. This maps to **optimal event scheduling** in distributed systems — a core concept in clock synchronization and Lamport timestamps.
