Given an array B1[] and a binary array B2[] each of size N, the task is to rearrange B1[i] in a way such that for all setbit position i of B2[i], the value of B1 [i] will be greater than the values where bit is not set in B2:[i] i.e for all (i, j) B1,[i] > B1.[j] when B2 [i]. = 1, B2,[j] = 0 (0 ≤ i, j < N).
•3m read time• From geeksforgeeks.org
Sort: