I wrote the following function to find the longest palindrome in a string. It works fine but it won't work for words like "noon" or "redder".  I fiddled around and changed the first line in the for loop from:  var oddPal = centere...
I am trying to find out whether a string is a palindrome by recursion using javascript. But I can't figure out what I am missing in the code.  var firstCharacter = function(str) {     return str.slice(0, 1); };  var lastCharacter = function(str)...
I have written this js code for palindrome, I know there are better and more efficient palindrome methods online but I want to know why I am unable to get my palindrome function to work properly?  CODE:     var pal = function(str) {    var len = str....
My code works in console but gives the wrong result in hackerank Problem: Print count of all substrings that are palindromes from a string    function isPalindrome(str) {    var len = str.length;   var mid = Math.floor(len / 2);    for (var i = 0; i...
I am having a problem with a palindrome function. This is my function :  function palindrome(str) {    var newStr= str.replace(/[^0-9a-z]/gi, '').toLowerCase().split("");    for(var i=0; i < (newStr.length)/2; i++){      if(newStr[...
I am trying to write a funciton in Javascript that will delete all the spaces and punctuation in the sentence, and then check if it's a palindrome. I've gotten most of it to work, however it won't delete the space after the period in cana...
I have written the following function in JavaScript to check if a singly Linked List is palindrome. However, I'm falling 2 out 10 tests, and I can't figure out why.  Here are the tests I'm falling.   l: [0, 1, 0] l: [1, 1000000000, -10000...
Instead of individually passing through the argument how can I loop through an array and check to see if each word is a palindrome? If it is I want to return the word if not i want to return a 0.  var myArray = ['viicc', 'cecarar', &#...
I am currently making a senior memory book my English class, and because I'm a nerd I am going to put a bit of code in it. Well, I'm having a bit of trouble with regex in my code. My entire code:     //For future reference, "alert(*parame...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.