A new method, based on a Monte Carlo scheme, is developed to determine physical properties of nonporous and porous solids. In the case of nonporous solids, we calculate the surface area. This surface area is found as the sumof areas of patches of different surface energy on the solid, which is assumed to take a patchwise topology (i.e., adsorption sites of the same energy are grouped together in one patch). As a result of this assumption,we derive not only the surface area, but also the accessible volume and the surface energy distribution. In the case of porous solids, the optimization method is used to derive the surface area and the pore size distribution simultaneously. The derivation of these physical properties is based on adsorption data from a volumetric apparatus. We test this novel idea with the inversion problem of deriving surface areas of patches of different energies for a number of nonporous solids. The method is also tested with the derivation of the pore size distribution of some porous solid models. The results are very encouraging and demonstrate the great potential of this method as an alternative to the usual deterministic optimization algorithms which are known to be sensitive to the choice of the initial guess of the parameters. Since the geometrical parameters are physical quantities (i.e., only positive values are accepted), we also propose a scheme to enforce the positivity constraint of the solution.