compute minimal height