# 2 Paper Strip Coding Challenge

You are given two paper strips. On each strip, numbers (1,2,… N) are written in random order. Cut the original paper strip into several pieces and rearrange those pieces to form the desired sequence.

Write a function, efficiently with respect to time used, returns the minimum number of cut pieces needed to perform the described operation.

For example, the following code should display 3 because the pieces used should be (1), (4, 3) and (2):

``int[] original = new int[] { 1, 4, 3, 2 }; int[] desired = new int[] { 1, 2, 4, 3 }; Console.WriteLine(PaperStrip.MinPieces(original, desired)); ``

Another example, the following code should display 5 because the pieces used should be (1), (2), (3), (4, 5, 6) and (8, 9, 10):

``int[] original = new int[] { 8, 9, 10, 4, 5, 6, 3, 2, 1 }; int[] desired = new int[] { 1, 2, 3, 4, 5, 6, 8, 9, 10 }; Console.WriteLine(PaperStrip.MinPieces(original, desired)); ``

Here’s the code you can implement: using System;

``public class PaperStrip {    public static int MinPieces(int[] original, int[] desired)    {       Throw new NotImplementedException(“Waiting to be implemented”);    }     Public static void Main(string[] argos)    {       // Easy       int[] original = new int[] { 1, 4, 3, 2 };       int[] desired = new int[] { 1, 2, 4, 3 };       Console.WriteLine(PaperStrip.MinPieces(original, desired));        // Advance       int[] original = new int[] { 8, 9, 10, 4, 5, 6, 3, 2, 1 };       int[] desired = new int[] { 1, 2, 3, 4, 5, 6, 8, 9, 10 };       Console.WriteLine(PaperStrip.MinPieces(original, desired));    } } ``

I’m not sure where to begin with this one… any hints, guidance or answers are greatly appreciated. Thank you in advance.