To answer this you can use a guess and check strategy.
You can start with having the ostrich run 10 mph. If they run 5 mile it would take 1/2 hour.
If the giraffe runs 5 miles per hour, it would run 2.5 miles in half an hour.
You can the double the speed.
If an ostrich runs 20 mph, it would take 1/4 hour to go 5 miles.
The giraffe would run 15 miles per hour so it would travel 1/4 x 15= 3.75 miles. Closer.
Next, if the ostrich runs 25 mph, it will take 1/5 hour to go 5 miles.
If the giraffe runs 20 mph, it will go 4 miles because 1/5 x 20 = 4 miles.
The ostrich's speed is 25 mph, and the giraffe's is 20 mph.
Another way to do this is to write equivalent ratios until the speed are 5 mph apart.
4/5, 8/10, 12/15, 16/20, 20/25.