alternative solution using numbers and sets
IntuitionApproachComplexity
Time complexity:

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

# Approach
<!-- Describe your approach to solving the problem. -->

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

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

# Code
```java []
class Solution {
    public boolean isFascinating(int n1) {
        int n2 = n1 * 2;
        int n3 = n1 * 3;

        Set<Integer> set = new HashSet<>();
        for (int i = 1; i <= 9; i++) set.add(i);

        while (n1 > 0) {
            if (!set.remove(n1 % 10)) return false;
            n1 /= 10;
        }

        while (n2 > 0) {
            if (!set.remove(n2 % 10)) return false;
            n2 /= 10;
        }

        while (n3 > 0) {
            if (!set.remove(n3 % 10)) return false;
            n3 /= 10;
        }

        return set.size() == 0;
    }
}
```
['Number Theory', 'Ordered Set', 'Java']