String Practice 2 Comments

Comments

  • a solution:

    my code

  • a solution:

    my code

  • a solution:

    my code

  • 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`

  • a solution:

    my code

  • a char is not af reference but a value (primitive) so .equal wont work cause it cant be dereferenced.. i learned this doing this example. complicated but we do learn :-)

    a solution:
    my code

  • a solution:

    my code

  • Uhm a space is not a character right?

  • It shouldn't make a difference in this challenge, but a space is a character just like any other.

  • Thx
    it does matter since i have to count them in, right.

  • Yes that's correct, you need to count the spaces. (I thought there were the same number of spaces on each side, but I see that's not the case.)

  • I solved it, but i stil get wrong output one 1 item. The fault is not my code this thime! check it.

    for 12Java12345 i get true and i thould be false. When i run it in eclips it gives false ( so its not my code).
    what is going wrong?

  • Here is a solution:

    my code

  • Please, a little more help?

  • Please can i just get the awnser even on stack they cant seem to figure it out?

  • It's a little easier to solve this challenge if you used the "counting solution" for the last problem. If you sorted, you can adjust your algorithm to go through the letters comparing them...

  • Check my solution please. it is the right solution. In Eclips al the ouput is like it should be, but here it gives two errors?

    carthorse orchestra: should give true in eclips it does!!

    Here when i run my code it gives false. i had this problem earlier , but the code is really correct?

  • Be careful when using Java's containsAll since it doesn't check the number of times an item appears.

  • I know, thats why i have the third list. I compare it to a third list. please check this.
    It works on eclipse for me in all examples. i use a third list and check the containsAll but also the length.. So that is not the problem.

  • Turns out it's a difference between Java 7 (running on this site) and Java 8. See StackOverflow for more details.

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