Since the time to paint walls is proportional to the number of walls (W) and inversely proportional to the number of people (P), then
Time = kW/P where k is the proportionality constant
In the first case,
Time = k(5)/4 = 45 minutes So, k = 36
So, in the second case,
Time = 36(4)/6 = 24 minutes