Four people lined up in the school boiling water room to receive water. It takes 4 minutes for a small flower, 5 minutes for a small red bucket, 3 minutes for Xiaoping and 1 minute for Xiaoyan.

Because 1 < 3 < 4 < 5, so:

The order of fetching water is: Xiaoyan → Xiaoping → Xiaohua → Xiaohong;

At this point, the total time they wait is:

1×4+3×3+4×2+5× 1,

=4+9+8+5,

=26 (minutes);

Answer: When the order of fetching water is Xiaoyan, Xiaoping, Xiaohua and Xiaohong, the total waiting time of the four students is the least, which is 26 minutes.