Back to problems

Tool Changer

Algorithm · Salesforce · Easy

A CNC machine’s tool carousel holds a circular sequence of tools. The carousel can rotate in either direction (left or right), advancing one slot per step. Starting from the currently active tool, you need to bring a specific target tool into the spindle. Because the carousel is circular, moving past the last slot wraps around to the beginning. Given an array tools representing the sequence of tool names in order around the carousel, the 0‑based index startIndex of the…

Checking your access…