Check whether the number can be made palindromic after adding K | Function to check whether a number is a palindrome or not ; Convert num to string ; Comparing kth character from the beginning and N - kth character from the end . If all the characters match , then the number is a palindrome ; If all the above conditions satisfy , it means that the number is a palindrome ; Driver Code
function checkPalindrome ( num ) { let str = num . toString ( ) ; let l = 0 , r = str . length - 1 ; while ( l < r ) { if ( str [ l ] != str [ r ] ) { document . write ( " " ) ; return ; } l ++ ; r -- ; } document . write ( " " ) ; return ; } let n = 19 , k = 3 ; checkPalindrome ( n + k ) ;