## Convert an array into another by repeatedly removing the last element and placing it at any arbitrary index

Convert an array into another by, Suppose there are two arrays A[] and B[], both developed of a permutation of first N natural numbers, then the task is to count the minimum number of times the last array element is required to be shifted to any arbitrary position…