Numbers At Most N Given Digit Set

How to approach this question when 0 is also included in the digit set . My solution is giving wrong anser for this.

proble link;https://leetcode.com/problems/numbers-at-most-n-given-digit-set/