Check if the given array can be reduced to zeros with the given operation performed given number of times | Function that returns true if the array can be reduced to 0 s with the given operation performed given number of times ; Add in Set only unique elements ; Count of all the unique elements in the array ; Driver code
< ? php function check ( & $ arr , $ N , $ K ) { $ unique = array_unique ( $ arr ) ; if ( count ( $ unique ) == $ K ) return true ; return false ; } $ arr = array ( 1 , 1 , 2 , 3 ) ; $ N = count ( $ arr ) ; $ K = 3 ; if ( check ( $ arr , $ N , $ K ) ) echo " Yes " ; else echo " No " ; ? >