bottom to up best solution