Assuming these bricks are of uniform density, the center of mass is at the middle of the brick, distance L/2 from each side. Suppose the upper brick is set so that it extends distance y beyond the lower brick. Where is the center of mass of the two together? Set the two bricks on the surface so that their joint center of mass is right on the edge.