Making zero array by decrementing pairs of adjacent | C # implementation of the above approach ; converting array element into number ; Check if divisible by 11 ; Driver Code
using System ; class GFG { static bool isPossibleToZero ( int [ ] a , int n ) { int num = 0 ; for ( int i = 0 ; i < n ; i ++ ) num = num * 10 + a [ i ] ; return ( num % 11 == 0 ) ; } public static void Main ( ) { int [ ] arr = { 0 , 1 , 1 , 0 } ; int n = arr . Length ; if ( isPossibleToZero ( arr , n ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }