别的题解
y总思路的题解
记录当前状态的距离,若为最终状态下的距离,输出之
查询x在字符串中的下标,然后转换为在矩阵中的坐标
如果没有越界,交换位置,记录距离
#include<bits/stdc++.h>
using namespace std;
int bfs(string start)
{
queue<string> q;
unordered_map<string, int> d;
d[start] = 0;
q.push(start);
while (q.size())
{
string end