Algorithm · Karat · Hard
You are planning a holiday that travels between cities by train, and your goal is to visit the largest possible number of museums before a fixed time budget runs out. The trip may begin in any city you choose. Whenever you enter a city, you are required to visit all of the museums located there. Each city may be entered no more than two times; if you come back to a city you have already visited, its museums do not count toward your total a second time. Determine the maximum…