Company: IBM
Difficulty: medium
Tool Changer A milling machine in a manufacturing facility has a tool change system. The tool changer holds n tools and some duplicate tools may be included. The operator must move through the tools one at a time, either left or right. The tool changer is circular, so when the last tool in the tools array is reached in either direction, the next tool is at the other end of the array. Given the name of the next tool needed, determine the minimum number of left/right moves to reach it. Function Description Complete the function toolchanger with the following parameters: tools : an array of tool names arranged in the order they appear in the tool changer startIndex : index of the tool currently in use target : name of the tool needed Returns: INTEGER - the minimum number of moves required Constraints 1 ≤ n ≤ 100 0 ≤ startIndex ≤ n-1 1 ≤ lengths of tools[i] and target ≤ 100 target is in tools Example Input: tools = [\'ballendmill\', \'facemill\', \'keycutter\', \'slotdrill\'] startIndex =