Back to Practice
#0176
Boat Speed in Still Water
MediumAptitude25 min20 XP
Problem
A boat travels downstream at 18 km/h and upstream at 12 km/h. Find the speed of the boat in still water.
Why This Matters
Boat-stream questions are rate problems disguised with vocabulary.
Examples
Example 1
Inputdownstream = 18, upstream = 12
Output15 km/h
Still-water speed is the average of downstream and upstream speeds: (18 + 12) / 2.
Constraints
- Return the exact requested output.
- Handle ordinary edge cases.
- Prefer simple, interview-readable code.
CodeReasoning
A boat travels downstream at 18 km/h and upstream at 12 km/h. Find the speed of the boat in still water.
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
Inputdownstream = 18, upstream = 12
Expected15 km/h
Still-water speed is the average of downstream and upstream speeds: (18 + 12) / 2.
Hidden Test Categories
empty or minimal inputduplicates or tieslarger input