id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > jan8_2016_SLHLalmostPalindrome
prev  |  next  |  chance

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)

public boolean jan8_2016_SLHLalmostPalindrome(String str, int offBy) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 310

Copyright Nick Parlante 2017 - privacy