C++ BFS Solution
Runtime: 272 ms, faster than 80.00% of C++ online submissions for Lexicographically Smallest String After Applying Operations.\nMemory Usage: 104.7 MB, less tha
Runtime: 272 ms, faster than 80.00% of C++ online submissions for Lexicographically Smallest String After Applying Operations.\nMemory Usage: 104.7 MB, less than 60.00% of C++ online submissions for Lexicographically Smallest String After Applying Operations.\n\n```\nclass Solution {\npublic:\n    \n    // return string after add operation\n    string AddOperation(string s, int a)\n    {\n        for(int i=1;i<s.length();i+=2)\n            s[i] = (s[i]-\'0\'+a)%10 + \'0\';\n        \n        return s;\n    }\n    \n    // return string after rotate operation\n    string RotateOperation(string s, int b)\n    {\n        int left = s.length()-b;\n        \n        string str = s.substr(left,b) + s.substr(0,left);\n        \n        return str;\n    }\n    \n    string findLexSmallestString(string s, int a, int b) {\n        \n        // track processed strings\n        unordered_map<string,bool>visited;\n        \n        queue<string>Q;\n        \n        string result = "";\n        \n        Q.push(s);\n        visited[s] = true;\n        \n        string curr;\n        \n        while(!Q.empty())\n        {\n            curr = Q.front();\n            Q.pop();\n            \n            // get lexical small string\n            if(result.empty() || lexicographical_compare(curr.begin(),curr.end(),result.begin(),result.end()))\n                result = curr;\n            \n            // get strings after add and rotate operations\n            string addString = AddOperation(curr,a);\n            string rotateString = RotateOperation(curr,b);\n            \n            // push addString if not already processed\n            if(visited.count(addString)==0)\n            {\n                visited[addString] = true;\n                Q.push(addString);\n            }\n            \n            // push rotateString if not already processed\n            if(visited.count(rotateString)==0)\n            {\n                visited[rotateString] = true;\n                Q.push(rotateString);\n            }\n        }\n        \n        return result;\n    }\n};\n```
['Breadth-First Search', 'C']