works about 70percent of the time, consider implementing DP solution