You have won a collection of tickets on luxury cruisers. Each ticket can be
used only once, but can be used in either direction between the 2 cities printed
on the ticket. Your prize gives you free airfare to any city to start your
cruising, and free airfare back home from wherever you finish your cruising.
You love to sail and don't want to waste any of your free tickets. How many additional
tickets would you have to buy so that your cruise can use all of your tickets?
Create a class MaxTrip that contains a method minBuy that is given Strings
portA and portB and that returns the smallest number of
additional tickets that can be purchased to allow you to use all of your free tickets.
Each position in portA and portB corresponds to one free ticket, allowing you to travel either way between the cities denoted by the corresponding character
in portA and in portB.
|