We have an array of random lenght and random numbers eg.
[12, 2345, 232, 52, 24].
And we Want to select only those defined by a binary number so eg.
5= 101 = [0, 0, 1, 0, 1]
so the Array X which i want to get is
[0, 0, 232, 0, 24];
Example
int[] x = {12, 2345, 232, 52, 24};
int b = 5;
int[] X = eliminate(x, b);
//
x = [12, 2345, 232, 52, 24]
b = [ 0, 0, 1, 0, 1]
X = [ 0, 0, 232, 0, 24]
any quick way to do this?
Thanks