What he wants you to do is find out whether the sequence of characters in the array is a palindrome. You don't need to return any information about it. If you are still stuck, here are some tips:
- It's a lot easier to work with
String
s thatchar[]
s. Try creating a string out of the array and using that in your computations. It may seem that the number parameter is redundant, but I would be safe and construct the string like this:
new String(a, 0, number)
- Now, you should probably filter the string to get rid of uppercase letters and spaces. That gets unnecessary info out of the way.
- Now, perhaps remove the middle character of the string, if there is one. That makes the number of chars even.
- Now split the string along the middle, reverse one half, and compare the two halves. After that, you know whether it is a palindrome, and you are done.