You are viewing a single comment's thread. Return to all comments →
Ya good bro! it can be done by this way also ;)
static String appendAndDelete(String s, String t, int k) { int noOfOpration = s.length()+t.length(),len; if(s.length() < t.length()) len=s.length(); else len=t.length();
for(int i=0; i<len; i++) { if(s.charAt(i)==t.charAt(i)) noOfOpration-=2; else break; } return (noOfOpration > k) ? "No" : (noOfOpration%2 == k%2) ? "Yes" : ((s.length()+t.length()-k)<0) ? "Yes" : "No"; }
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 →
Ya good bro! it can be done by this way also ;)