Given an Array of String containing names of Tools (can have duplicates), the Starting index and A Target Tool, find the Minimum Number of Steps required to reach the target tool from the starting index. The Array is Circular, that is, If you reach the End of the array, you can go to its start and vice versa.
Sample Testcase:
Tools : ['saw', 'hammer', 'mallet',
'file', 'saw', 'ladder', 'scissor']
Starting Index : 6 {i.e. 'scissor'}
To Find : 'saw'
Answer:
1
Minimum Steps = min(2 Steps to Left, 1 Step to Right [Circular]) = 1 Step