look for edge case, dp is not always the best solution