Palindrome


Premium Content - Free Preview

A palindrome is a sentence that reads the same backwards and forwards, when the spaces are removed. For example, "madam im adam". Can you write a program that identifies if a sentence is a palindrome?


End of Free Content Preview. Please Sign in or Sign up to buy premium content.

Comments

  • a solution:

    my code

  • Can anyone help me with this... my code is returning false all the way down... I'm not seeing where I went wrong:

    String clean = word.replace(" ", "");
    
    cont...
  • Working Ruby boilerplate:
    def palindrome?(string)

    end
    
    t = gets.to_i
    t.times do
        sentence = gets.chomp
        print palindrome?(sentence), "\n"
    end
    
  • Trying this again (having trouble with formatting the code):

    `def palindrome?(string)

    end

    t = gets.to_i
    t.times do
    sentence = gets.chomp
    print palindrome?(sentence), "\n"
    end`

Contact Us
Sign in or email us at [email protected]