6 kyu

Single character palindromes

727 of 2,136KenKamau

Description:

You will be given a string and you task is to check if it is possible to convert that string into a palindrome by removing a single character. If the string is already a palindrome, return "OK". If it is not, and we can convert it to a palindrome by removing one character, then return "remove one", otherwise return "not possible". The order of the characters should not be changed.

For example:

solve("abba") = "OK". -- This is a palindrome
solve("abbaa") = "remove one". -- remove the 'a' at the extreme right. 
solve("abbaab") = "not possible". 

More examples in the test cases.

Good luck!

If you like this Kata, please try Single Character Palindromes II

Algorithms

Stats:

CreatedDec 9, 2017
PublishedDec 15, 2017
Warriors Trained3895
Total Skips90
Total Code Submissions10207
Total Times Completed2136
JavaScript Completions727
Python Completions808
Ruby Completions97
Haskell Completions47
C++ Completions143
Java Completions200
C# Completions152
Rust Completions56
Total Stars66
% of votes with a positive feedback rating93% of 448
Total "Very Satisfied" Votes392
Total "Somewhat Satisfied" Votes50
Total "Not Satisfied" Votes6
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • KenKamau Avatar
  • imjasonmiller Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • glamarca Avatar
  • hobovsky Avatar
  • saudiGuy Avatar
Ad