A self-dividing number is divisible by every one of its digits, and it may not contain the digit 0. For example, 128 is self-dividing because 128 % 1, 128 % 2 and 128 % 8 are all 0. Given two integers left and right, return every self-dividing number in the range [left, right], in increasing order.
A self-dividing number is divisible by every one of its digits, and it may not contain the digit 0. For example, 128 is self-dividing because 128 % 1, 128 % 2 and 128 % 8 are all 0. Given two integers left and right, return every self-dividing number in the range [left, right], in increasing order.
Example 1:
Input: {"left":1,"right":22}
Output: [1,2,3,4,5,6,7,8,9,11,12,15,22]
Constraints:
1≤left≤right≤104
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"left":1,"right":22}
Test every number from 1 to 22: it must be divisible by each of its own digits, and no digit may be 0.