Maximum number of 2 x2 squares that can be fit inside a right isosceles triangle | Program to count number of 2 x 2 squares in a right isosceles triangle ; Removing the extra part we would always need ; Since each square has base of length of 2 ; Driver code
function numberOfSquares ( base ) { base = ( base - 2 ) ; base = Math . floor ( base / 2 ) ; return base * ( base + 1 ) / 2 ; } let base = 8 ; document . write ( numberOfSquares ( base ) ) ;