Finding CB numbers

explain how to approach this problem???

idea is to generated the subaray/substrnig
and for each check whether it is CB or not?

to check CB No conditions are given in question

main point is you can’t use a digit twice
so make a visited array to keep track of indexes already considerd

for more clearity you can see reference code
Reference Code