Hi,guys.
Now, I am confused by one ‘simple’ algorithm. It is like this:
one array:
index 0 1 2 3 4 5 6 7 8 9
a[] 0 0 1 0 0 1 0 1 0 1
I want to put the elements which has value!=0 in a into a new array, the elements in the array are the indexes indicate that which value is not 0.
result:
index 0 1 2 3
result[] 2 5 7 9
Some guys has done this or met this before?