C ++ implementation of the approach
#include <bits/stdc++.h> NEW_LINE using namespace std ; int index ( vector < int > vec , int value ) { vector < int > :: iterator it ; it = find ( vec . begin ( ) , vec . end ( ) , value ) ; return ( it - vec . begin ( ) ) ; }