yesterday I had a coding interview in which I was asked the following problem which I was not able to solve. please help me to figure out an approach for this problem.
Problem: Alex has a permutation of first n natural numbers in an array A for this permutation he has calculated another array B which is done as follows
B[i] will contain the number of elements on left of index i which are bigger then a[i], now somehow Array A is lost then we have to regenerate the array A from array B.