Pergunta de entrevista da empresa Schneider Electric

Find the minimum distance between given two elements in an array.