Блог пользователя TheHoodyGang

Автор TheHoodyGang, история, 12 месяцев назад, По-английски

please tell me why my code is not working. According to me I am doing everything correctly. question:1822E - Making Anti-Palindromes Submission :205734412

  • Проголосовать: нравится
  • -10
  • Проголосовать: не нравится

»
12 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

The first problem with that code that you are considering strings with odd number of characters as an anti-palindrome in all the cases but that is not always true a string like aba is palindrome as we will be comparing first character with the last one and comparing the middle character with itself. After you remove that first if condition you will find that the second case in the sample is not right I think you can figure that out but if you didin't we can continue discussing the problem.