Making zero array by decrementing pairs of adjacent | PHP implementation of the above approach ; converting array element into number ; Check if divisible by 11 ; Driver Code
< ? php function isPossibleToZero ( $ a , $ n ) { $ num = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ num = $ num * 10 + $ a [ $ i ] ; return ( $ num % 11 == 0 ) ; } $ arr = array ( 0 , 1 , 1 , 0 ) ; $ n = sizeof ( $ arr ) ; if ( isPossibleToZero ( $ arr , $ n ) ) echo " YES " ; else echo " NO " ;