Minimum Penalty Path Discussions | Algorithms | HackerRank
  • Asked to answer
    + 4 comments
    Endorsed by f2014044

    Consider this

    A ->B -> C Cost (A,B)->1 (B,C) ->2 and (A,B) ->2 (Multiple edges can exist)

    In this case your approach from A to C will give 3. But the answer is 2.