Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] String Conversion by mozurin
"use strict";
function stepsToConvert(a, b)
{
if (!a || !b) {
return a.length + b.length;
}
const [prevA, prevB] = [a, b].map(e => e.slice(0, e.length - 1));
return Math.min(
stepsToConvert(prevA, b) + 1,
stepsToConvert(a, prevB) + 1,
stepsToConvert(prevA, prevB) + (a[a.length - 1] != b[b.length - 1])
);
}
June 27, 2018