2007. Maximum Cost of Trip With K Highways

Hard
Dynamic Programming
Bit Manipulation
Graph
Bitmask

Description

Hints

Hint 1
Are there any computations being repeated?
Hint 2
The same path can be visited multiple times. Could we reuse the previously calculated result?
Hint 3
Store the nodes seen on the current path and the last node on the current path as a dynamic programming state.

Statistics

Acceptance
50.9%
Submissions
4,568
Accepted
2,325