Hi Vikram! Obviously The naivest solution is O(n2). Could you give a hint for this problem?
On Oct 3, 4:39 pm, Vikram Singh <singhvikram...@gmail.com> wrote: > Given an array say A=(4,3,1,2). An array B is formed out of this in > such a way that B[i] = no. of elements in A, occuring on rhs of A[i], > which are less then A[i]. > eg.for the A given, B is (3,2,0,0). > Here A of length n only contains elements from 1 to n that too > distinct.. > Now the problem is: > 1). You are given with any such A. Find out corresponding B? > > 2). You are given with any such B. Find out corresponding A? > > Please provide solution in O(n),if possible?? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.