Vipul and modules hackerblocks

Why we are using bool ch[10] and i don’t understand how it is working , lets say I have number 223 , first i masked first digit and mark ch[s[0]-‘0’]=1, then third digit then how second digit will be masked as ch[s[0]-‘0’] is already 1 .

We have 10 possible digits from 0 to 9.
Let’s take 223.
There’s no difference in taking first 2 or second 2.
So all we need to take is different element. Hence by maintaining the 10 indexed array, we can proceed.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.