Given an array like ['8', '2', '5', '3'], and an integer n. Write a function to generate id, the id can not contain n continuous digit. All the digit must from the given array.
For example, if n equals to 2, the current id is 8253, the next will be 8258, because 8255 has two 5 continuously.
How to solve it?