Since we traverse dp [ ] [ ] from bottom , we get result in reverse order .
String reverse = " " ; for ( int k = res . length ( ) - 1 ; k >= 0 ; k -- ) { reverse = reverse + res . charAt ( k ) ; } return reverse ; }