iteration on numbers with no 2 same digits
Posted
by rahmivolkan
on Stack Overflow
See other posts from Stack Overflow
or by rahmivolkan
Published on 2010-04-03T07:46:23Z
Indexed on
2010/04/03
7:53 UTC
Read the original article
Hit count: 224
I dont know if it is asked (I couldn't find any).
I want to iterate on this kind of numbers implemented on array;
int a[10];
int i = 0;
for( ; i < 10; i++ )
a[i] = i+1;
now the array has
"1 2 3 4 5 6 7 8 9 10"
and I want to get
"1 2 3 4 5 6 7 8 10 9"
and then
"1 2 3 4 5 6 7 9 8 10"
"1 2 3 4 5 6 7 9 10 8"
. . . .
I tried to get an algorithm but I couldn't figure it out. Is there an easy way to implement "next" iterator for this kind of problems?
Thanks in advance
© Stack Overflow or respective owner