A chassis is the trailer to carry the container. The truck pulls the trailer/chassis.
Often chassis dont have cranes to (un)load containers themselves and therefore require cranes (capex heavy assets). Such cranes aren't everywhere/in surplus.
Slightly offtopic, but very practical use of a comparable algorithm is to determine to what extent a date ranges falls between a first and last date (e.g. first date of the year, last date of year).
e.g. in Excel it would look like: MAX((MIN(end date range; last date) - MAX(Start date range;first date) + 1);0)/(last date - first date + 1). This results in 0 in case of no match, a fraction when only a part of the date range falls between the first and last date, and 1 in case it matches completely or even exceeds the first and last date.
Often chassis dont have cranes to (un)load containers themselves and therefore require cranes (capex heavy assets). Such cranes aren't everywhere/in surplus.