Compare vector elements with values in Map
foreach ( KeyValuePair < int , int > entry in mp ) { if ( entry . Value != v [ i ] ) { flag = 1 ; break ; } i ++ ; } if ( flag == 1 ) return " YES " ; else return " NO " ; }