about | help | code help+videos | done | prefs |
Write a method that returns 'true' if the input parameter string is ALMOST a palindrome. By ALMOST, I mean that at most 'offBy' characters would need to be changed in order to make the string a palindrome. For example, "dan" is NOT a palindrome, but it could become one by changing either the 'd' to an 'n' or by changing the 'n' to a 'd'. Either way, it takes at most 1 change to make it a palindrome. The parameter 'offBy' is the maximum number of changes you are allowed to make. Return 'true' if it is possible to make the string into a palindrome with AT MOST 'offBy' changes. Return 'false' otherwise. jan8_2016_SLHLalmostPalindrome("racecar", 0) → true jan8_2016_SLHLalmostPalindrome("dan", 1) → true jan8_2016_SLHLalmostPalindrome("offset", 3) → true ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 310
Copyright Nick Parlante 2017 - privacy