문제 링크입니다: https://www.acmicpc.net/problem/1327 BFS(Breadth First Search) 알고리즘 문제였습니다.문자열의 substr 메소드를 잘 이용하면 쉽게 풀 수 있는 문제였습니다.visited는 map을 이용하여 공간 복잡도를 줄이도록 노력했습니다. #include #include #include #include #include using namespace std; int N, K; int BFS(string s) { queue q; q.push({ s, 0 }); map visited; string target = s; sort(target.begin(), target.end()); //오름차순 while (!q.empty()) { string cur = ..