dp: optimal bottom optimal height