algorithm - How to find the numbers of steps -
i giving n cities , have reach city a b in m steps. if directly go city x y it's consider 1 step , can visit city multiple times.
now given array power_of_two[i][j][k] represent cost of going city i j in 2^k steps.
now given m have find minimum cost reach city a b in m steps.
m can upto 32 bit numbers , n 20.
how solve ?
my approach:
making dp[mask bit of m used][last city visited] , since m 32 bit it's can work ? efficient solution ?
Comments
Post a Comment