Get Minimum Steps

Problem Overview

  • Find the minimum steps to transform the current layer order into the desired order using one allowed move: take the last layer and insert it anywhere.
  • Input: arrays current[n] and desired[n]. Output: integer minimum steps. The target arrangement is always achievable.
  • Context: reordering layers in a neural network architecture during model training.
  • From Expedia interviews; a coding interview problem and interview question on array transformation.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: