2007. Maximum Cost of Trip With K Highways

Hard
Dynamic Programming
Bit Manipulation
Graph Theory
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
51.1%
Submissions
4,672
Accepted
2,388