C++ | O(1) | Full Explanation | Easy Solution with comments
\n# Approach\n- Convert the input number n into a string str.\n- Compute n2 = 2 * n and n3 = 3 * n.\n- Concatenate str with the strings representing n2 and n3.\
\n# Approach\n- Convert the input number n into a string str.\n- Compute n2 = 2 * n and n3 = 3 * n.\n- Concatenate str with the strings representing n2 and n3.\n- Initialize an array digitCount of size 10 to keep track of the count of each digit from 0 to 9.\n- Iterate through each character in string.\n-If the character is \'0\', return false as fascinating numbers should not contain any zeros.\n-Increment the count of the corresponding digit in digitCount.\n-Check if each digit from 1 to 9 appears exactly once in digitCount. If not, return false.\n-If all conditions are satisfied, return true as the number is fascinating.\n\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool isFascinating(int n) {\n    string str = to_string(n);\n    int n2 = n * 2;\n    int n3 = n * 3;\n    str += to_string(n2);\n    str += to_string(n3);\n\n    vector<int> digitCount(10); // count of each digit from 0 to 9\n\n    for (int i = 0; i < str.size(); i++) {\n        if (str[i] == \'0\')\n            return false; // If any digit is 0, return false\n        digitCount[str[i] - \'0\']++;\n    }\n\n    for (int i = 1; i <= 9; i++) {\n        if (digitCount[i] != 1)\n            return false; // If any digit appears more than once or none, return false\n    }\n\n    return true; // All conditions satisfied, return true\n}\n};\n```\n**Please upvote if it helped. Happy Coding!**
['C++']