Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def palindromeRearranging(inputString)
- array = Array.new
- x = 0
- while (x < 256)
- array[x] = 0
- x = x + 1
- end
- x = 0
- while (x < inputString.length)
- number = inputString[x].ord
- array[number] = array[number] + 1
- x = x + 1
- end
- odd = 0
- x = 0
- while (x < 256)
- if array[x] % 2 != 0 then
- odd = odd + 1
- end
- x = x + 1
- end
- if odd == 0 or odd == 1 then
- return true
- else
- return false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement