Minimum number of deletions to make a string palindrome | Function to return minimum Element between two values ; Utility function for calculating Minimum element to delete ; Condition to compare characters ; Recursive function call ; Return value , increamenting by 1 ; Function to calculate the minimum Element required to delete for Making string pelindrom ; Utility function call ; Driver code
function min ( x , y ) { return ( x < y ) ? x : y ; } function utility_fun_for_del ( str , i , j ) { if ( i >= j ) return 0 ; if ( str [ i ] == str [ j ] ) { return utility_fun_for_del ( str , i + 1 , j - 1 ) ; } return 1 + Math . min ( utility_fun_for_del ( str , i + 1 , j ) , utility_fun_for_del ( str , i , j - 1 ) ) ; } function min_ele_del ( str ) { return utility_fun_for_del ( str , 0 , str . length - 1 ) ; } let str = " " ; document . write ( " " + " " + min_ele_del ( str ) ) ;