text: Maximum number of squares that can fit in a right angle isosceles triangle | function for finding max squares ; return in O ( 1 ) with derived formula ; Driver program
code: function maxSquare ( b , m ) { return ( b / m - 1 ) * ( b / m ) / 2 ; a } let b = 10 , m = 2 ; document . write ( maxSquare ( b , m ) ) ;