You are viewing a single comment's thread. Return to all comments →
Yor explanation is hard to understand, check a look at me code. I think it easy to understand
function isItPossibleToModify($s, $t, $k) { $sLength = strlen($s); $tLength = strlen($t); if ($sLength < $tLength) { return ($tLength - $sLength) % 2 == 0; } $commonPrefix = 0; // find a largest common prefix between s and t for ($i = 0; $i < min($sLength, $tLength); $i++) { if ($s[$i] != $t[$i]) { break; } $commonPrefix++; } $needToProcess = ($tLength - $commonPrefix) + ($sLength - $commonPrefix); return $needToProcess <= $k; }
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 →
Yor explanation is hard to understand, check a look at me code. I think it easy to understand