Place N boys and M girls in different rows such that count of persons placed in each row is maximized | Function to calculate GCD of two numbers ; Function to count maximum persons that can be placed in a row ; Input ; Function to count maximum persons that can be placed in a row
function gcd ( a , b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } function maximumRowValue ( n , m ) { return gcd ( n , m ) ; } var N = 4 ; var M = 2 ; document . write ( maximumRowValue ( N , M ) ) ;