Amazon Interview Question

Second question (online test) - Graph (minimum path cost)