StackAdapt Interview Question

it is a gas moving problem