A self-dividing number is a number that is divisible by every digit it contains.


	For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.


A self-dividing number is not allowed to contain the digit zero.

Given two integers left and right, return a list of all the self-dividing numbers in the range [left, right].

&nbsp;
Example 1:
Input: left = 1, right = 22
Output: [1,2,3,4,5,6,7,8,9,11,12,15,22]
Example 2:
Input: left = 47, right = 85
Output: [48,55,66,77]

&nbsp;
Constraints:


	1 &lt;= left &lt;= right &lt;= 104


class Solution:
    def selfDividingNumbers(self, left: int, right: int) -> List[int]:
        res = []
        for num in range(left, right + 1):
            num_str = str(num)
            if '0' in num_str:
                continue
            elif all([num % int(digit_str) == 0 for digit_str in num_str]):
                res.append(num)
        return res
class Solution {
    public List<Integer> selfDividingNumbers(int left, int right) {
        List<Integer> ans= new ArrayList<>();
        while(left<=right){
            if(fun(left))
                ans.add(left);        
            left++;
        }
        return ans;
    }
    boolean fun(int x){
        int k=x;
        while(k>0)
        {
            int y=k%10;
            k=k/10;
            if(y==0||x%y!=0)
                return false;
        }
        return true;
    }
}
class Solution {
public:
    bool check(int n){
        vector<bool> isif(10);
        for(int i = 1; i <= 9; i++){
            if(n % i == 0) isif[i] = 1;
        }
        
        while(n > 0){
            if(isif[n%10] == 0) return false;
            n /= 10;
        }
        return true;
    }
    vector<int> selfDividingNumbers(int left, int right) {
        vector<int> ans;
        for(int i = left; i <= right; i++){
            if(check(i)) ans.push_back(i);
        }
        return ans;
    }
};
/**
 * @param {number} left
 * @param {number} right
 * @return {number[]}
 */
var selfDividingNumbers = function(left, right) {
  const selfDivisibles = [];
  for (let i = left; i <= right; i++) {
    if (checkDivisibility(i)) {
      selfDivisibles.push(i);
    }
  }
  return selfDivisibles;
};

function checkDivisibility(num) {
  let status = true;
  let mod;
  let original = num;
  while (num !== 0) {
    mod = Math.trunc(num % 10);
    if (original % mod !== 0) {
      status = false;
      break;
    }
    num = Math.trunc(num / 10);
  }
  return status;
}
Self Dividing Numbers