没做过这种图论的题目,一脸懵逼😳,看了大佬的解析,自己再总结(fushu)一遍: 将所有路径表示出来—— ->lot->log hit->hot ->cog ->dot->dog这个其实就是求图论中的单源最短路径,图中边是没有权重的,用BFS求解最合适(时间复杂度O(n))。 class Solution { public: int ladderLength(string start, string end, unordered_set &dict) { queue> ...