Can anyone help me with this question , unabled to come up with a solution ?

Revision en1, by Nilimsankar, 2024-08-12 22:32:07

Given two arrays, current and desired, each representing the order of n elements, find the minimum number of operations required to transform current into desired.

Operation: - In one operation, you can select an element from the end of the current array and insert it at any position within the array.

Output: - Return the minimum number of such operations needed to make current equal to desired.

TC-1 current — 2 1 3 5 4 desired — 2 4 1 5 3 output = 2

TC-2 current — 2 1 3 desired — 1 2 3 output= 2

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Nilimsankar 2024-08-12 22:32:07 628 Initial revision (published)