@edaengineer

Yes, it's a brute force solution and it get accepted with run time 616ms. It won't generate duplicates since if(move == minMove && find(res.begin(), res.end(), s) == res.end()) res.push_back(s); I have updated if(pos > s.size()) return; to if(pos > s.size() || move > minMove) return;, now it's much faster with run time 196ms.