Skip to content

Instantly share code, notes, and snippets.

View ramthenmala's full-sized avatar
🎯
Focusing

Ram kumar ramthenmala

🎯
Focusing
View GitHub Profile
// Function Revesred Integer
function mtdNumberReverse(n){
let reversed = n.toString().split('').reverse().join('')
reversed = parseInt(reversed)
if(n < 0){
return reversed * -1
}
return reversed
}
@ramthenmala
ramthenmala / panlindromeString.js
Last active March 27, 2022 13:32
String Palindrome
// Palindrome Algorithm
// Method A
function mtdPalindromeA(str){
str = str.toLowerCase()
return( str.toLowerCase() === str.split('').reverse().join('') )
}
mtdPalindromeA('Appa')
mtdPalindromeA('am i a palindrome')
// String Palindrome
// Reverse a string using reverse Method
function reverseStringMtd(str) {
return str
.split('')
.reverse()
.join('')
}
// Reverse a String using for Loop Method
function reverseLoopMtd(strChar) {