I have been trying to figure out how to code the following program using an NFA, (I have been at it for a week and yet to make progress on implementing correctly, currently have an inefficient bruteforce solution that takes a very long time without an NFA and was wondering if there would be some guidance on here to figure out the implementation of this problem)
The Problem in regards to being solved by an NFA goes as follows, , given an integer N and a subset D ⊆ {0, 1, … , 9} of digits, if N can be written as a sum of two integers X and Y that use only digits in D. For example, consider N = 130500633 and D = {1, 2, 8}. Since 130500633 = 128218812 + 2281821, the answer is yes. For a given D, define L(D) as the set of integers N that can be written as X + Y where X and Y use only digits in D. Build an NFA M for L(D), and implement a membership algorithm to test if N is in L(M). Assuming that the input can up to 100 digits long.