problem145 solved. Taking longer time. Need to think of faster algo.