Non | C # program to find first non - repeating element . ; Driver code
using System ; class GFG { static int firstNonRepeating ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) { int j ; for ( j = 0 ; j < n ; j ++ ) if ( i != j && arr [ i ] == arr [ j ] ) break ; if ( j == n ) return arr [ i ] ; } return - 1 ; } public static void Main ( ) { int [ ] arr = { 9 , 4 , 9 , 6 , 7 , 4 } ; int n = arr . Length ; Console . Write ( firstNonRepeating ( arr , n ) ) ; } }