Google Interview Question

first question was a graph-based question (Dijakstra's algo) second one was a string question