method 2 : to convert given string to a minimum size palidrome , keep a poststring which needs to be added to input string to make it a palindrome . keep adding character from start to end of input text to post string until string + poststring becomes a palindrome . time complexity : o n concode_field_sep PlaceHolder placeHolder concode_field_sep boolean isPalindrome concode_elem_sep void main concode_elem_sep String convertToMinSizePalindromeByPrependingChars
String function ( String arg0 ) { if ( arg0 == null || arg0 . length ( ) == 0 ) { return arg0 ; } String loc0 = "srini_string" ; int loc1 = 0 ; while ( ! isPalindrome ( arg0 + loc0 ) && loc1 < arg0 . length ( ) ) { loc0 = arg0 . charAt ( loc1 ) + loc0 ; loc1 ++ ; } return arg0 + loc0 ; }