Since arr [ i ] also exists in array , * ( it - 1 ) will be same as arr [ i ] . Let us check * ( it - 2 ) is also same as arr [ i ] . If true , then arr [ i ] exists twice in array , so ceiling is same same as arr [ i ]
if ( ( it - 1 ) != v . begin ( ) && * ( it - 2 ) == arr [ i ] ) {