Concept:
For the same distance:
\[
{Speed} \propto \frac{1}{{Time}} \Rightarrow {Time ratio is inverse of speed ratio}
\]
Step 1: Given speed ratio.
\[
A : B = 3 : 4
\]
Step 2: Time ratio (inverse).
\[
T_A : T_B = 4 : 3
\]
Step 3: Find time for B.
\[
T_A = 40
\]
\[
T_B = 40 \times \frac{3}{4} = 30
\]
Hence, B will take 30 minutes.