Solution with no redundant height calculation