Beats 100% time and space || Simple C++ Solution
IntuitionApproachComplexity
Time complexity: O(N)

Space complexity: O(1)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
![Screenshot 2025-02-20 200548.png](https://assets.leetcode.com/users/images/65775cec-1879-4b1e-b79d-c9d43d7498d3_1740062199.9284165.png)
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:

    bool check(int n){
        bool checkZero = false;
        while(n>0){
            if(n%10==0){
                checkZero = true;
                break;
            }
            n /= 10;
        }
        return checkZero;
    }
    void func(int n, vector<int> &v){
        while(n>0){
            v[(n%10) - 1]++;
            n /= 10;
        }
    }
    bool isFascinating(int n) {
        if(check(n) || check(2*n) || check(3*n)){
            return false;
        }
        vector<int> v(9,0);
        func(n, v);
        func(2*n, v);
        func(3*n, v);
        for(int i=0; i<9; i++){
            if(v[i]==1) continue;
            else return false;
        }
        return true;
    }
};
```
['Hash Table', 'Math', 'C++']