We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
My code is running everywhere and giving right output but while running test cases like **"aa" and "baab" ** fails?
publicstaticStringsuperReducedString(Strings){// Write your code here StringBuildersb=newStringBuilder(s+"");intl=0;while(l<=sb.length()-2){if(sb.charAt(l)==sb.charAt(l+1)){Stringtemp=superReducedString(sb.delete(l,l+2).toString());s=temp;// return sb.toString();}l++;}if(s=="")return"Empty string";returns;}
Super Reduced String
You are viewing a single comment's thread. Return to all comments →
My code is running everywhere and giving right output but while running test cases like **"aa" and "baab" ** fails?