Easiest java solution || Simple logic || 0ms || Faster than 100% | Fully Commented Code
\tclass Solution {\n\t\tpublic String breakPalindrome(String palindrome) {\n\t\t\t// If the string contains only one char then we will simply return blank strin
\tclass Solution {\n\t\tpublic String breakPalindrome(String palindrome) {\n\t\t\t// If the string contains only one char then we will simply return blank string \n\t\t\tif(palindrome.length()==1) return "";\n\t\t\tStringBuilder answer = new StringBuilder(palindrome);\n\t\t\t// If the string contains all the \'a\'s or only one char other than \'a\' which is in the middle,\n\t\t\t//then we can simply change the last char to \'b\'. This will make the string non-palindromic \n\t\t\t//and will be lexiographically smallest.\n\t\t\tif(isThisStringAnEdgeCase(palindrome)) {\n\t\t\t\tanswer.setCharAt(palindrome.length()-1 , \'b\');\n\t\t\t} \n\t\t\t// Here we will simply find the first char which is not \'a\', convert it to \'a\' and the string will become non-palindromic.\n\t\t\telse {\n\t\t\t\tfor(int i=0;i<answer.length();i++) {\n\t\t\t\t\tif(answer.charAt(i)!=\'a\') {\n\t\t\t\t\t\tanswer.replace(i,i+1,"a");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}   \n\t\t\t}\n\t\t\treturn  answer.toString();\n\t\t}\n\n\t\t/**\n\t\t* This method will return true if every chacter is \'a\' or if the string contains only one \n\t\t* character that is other than \'a\' and it\'s placed in the middle.\n\t\t* You can choose a better name for the method ;)\n\t\t*/\n\t\tprivate boolean isThisStringAnEdgeCase(String palindrome) {\n\t\t\tint start = 0;\n\t\t\tint end = palindrome.length()-1;\n\t\t\twhile(start<end) {\n\t\t\t\tif(palindrome.charAt(start)!=\'a\' || palindrome.charAt(end)!=\'a\') {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tstart++;\n\t\t\t\tend--;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}
['Java']