C++ 0ms solution


  • 0
    C
        vector<string> generatePossibleNextMoves(string s) {
            
            vector<string> result;
            if(s.size() < 2)
                return result;
    
            for(int i = 1; i < s.size(); i++)
            {
                if(s[i-1] == '+')
                    if(s[i] == s[i-1])
                    {
                        result.emplace_back(s);
                        result[result.size()-1][i] = 
                        result[result.size()-1][i-1] = '-';
                    }
            }
            return result;
        }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.