Description
Submission
class Solution { public: bool isStrobogrammatic(string num) { unordered_map<char, char> m {{'0', '0'}, {'1', '1'}, {'2', 'X'}, {'3', 'X'}, {'4', 'X'}, {'5', 'X'}, {'6', '9'}, {'7', 'X'}, {'8', '8'}, {'9', '6'}}; for(int i = 0, j = num.size() - 1; i <= j; ++i, --j) { if(num[j] != m[num[i]]) return false; } return true; } };