Function to print the desired result after computation
< ? php function isHalfReducible ( $ arr , $ n , $ m ) { $ frequencyHash = array_fill ( 0 , $ m + 1 , 0 ) ; $ i = 0 ; for ( ; $ i < $ n ; $ i ++ ) { $ frequencyHash [ ( $ arr [ $ i ] % ( $ m + 1 ) ) ] ++ ; } for ( $ i = 0 ; $ i <= $ m ; $ i ++ ) { if ( $ frequencyHash [ $ i ] >= ( $ n / 2 ) ) break ; } if ( $ i <= $ m ) echo " Yes STRNEWLINE " ; else echo " No STRNEWLINE " ; }