How to check if numbers 0 to 9 have appeared atleast once in a stream of numbers in C++?
<p>There is a stream of incoming numbers (in Base 10, could be any number having 'n' digits, say the stream could be 123, 8, 670, 4835134, 50243)</p>

<p>I have to check if all the digits 0 to 9 have appeared after reading the entire stream.</p>

<p>Ex. if stream is <code>123, 8, 670, 48351934, 50243,</code> then the answer is "TRUE" (from 0 till 9, a number has appeared at least once)</p>

<p>if the stream is <code>123, 8, 670, 4835134,  50243,</code> then the answer is "FALSE" because 9 did not appear in any of the numbers in the stream</p>

<p>Fix - 1
I thought I can take Can take OR from 0 till 9 and have it (allORresult)
Calucatate OR of all the numbers in the stream (streamORresult)
If the set bits of allORresult and streamORresult are similar, then we can conclude all the numbers,0 to 9 have appeared atleast once in the numbers of the stream.</p>

<p>Fix - 2
Take the naive approach! Decompose the number starting from ones digit (%10 then /10) and set a flag for each digit. If all the digits are encountered, then return TRUE</p>