Company: Amazon_7aug

Difficulty: medium

Problem Statement

Code Question 2 Problem Description Given two strings, warehouseLayout and idealLayout , both consisting of lowercase English alphabetical characters, representing the items in an Amazon warehouse by their IDs, you are allowed to perform the following inventory operation on warehouseLayout any number of times: Remove the last item from warehouseLayout and place it anywhere within warehouseLayout . Determine the minimum number of operations required to make warehouseLayout identical to idealLayout . If it is not feasible, return -1. Function Description Complete the function findminOperations in the editor below. findminOperations has the following parameters: string warehouseLayout : the initial IDs in the Amazon warehouse. string idealLayout : the final IDs in the Amazon warehouse. Returns: int : the minimum number of operations required to make warehouseLayout identical to idealLayout . int findminOperations(string warehouseLayout, string idealLayout) { Examples Example 1: Input: war

More Amazon_7aug OA questionsInterview experiences