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.
publicstaticStringappendAndDelete(Strings,Stringt,intk){// Write your code hereif(s.length()+t.length()<=k)return"Yes";intn=0;while(n<Math.min(s.length(),t.length())&&s.charAt(n)==t.charAt(n)){n++;}intoperationsLeft=k-s.length()-t.length()+2*n;if(operationsLeft%2==0&&operationsLeft>=0){return"Yes";}return"No";}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Append and Delete
You are viewing a single comment's thread. Return to all comments →
Java