C # program to find the repeating and missing elements using Maps
using System ; using System . Collections . Generic ; class GFG { public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 3 , 6 , 2 , 1 , 1 } ; Dictionary < int , Boolean > numberMap = new Dictionary < int , Boolean > ( ) ; int max = arr . Length ; foreach ( int i in arr ) { if ( ! numberMap . ContainsKey ( i ) ) { numberMap . Add ( i , true ) ; } else { Console . WriteLine ( " Repeating ▁ = ▁ " + i ) ; } } for ( int i = 1 ; i <= max ; i ++ ) { if ( ! numberMap . ContainsKey ( i ) ) { Console . WriteLine ( " Missing ▁ = ▁ " + i ) ; } } } }