Help in interview problem

Revision en1, by nipul1, 2020-08-12 06:40:42

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.

Tags #interview, datastructure

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English nipul1 2020-08-12 06:40:42 526 Initial revision (published)