You are viewing a single comment's thread. Return to all comments →
function stringConstruction(s) { let [i, sLength, cost] = [0, s.length, 0]; while (i < sLength) { if (!s.slice(0, i).includes(s[i])) cost++; i++; } return cost; }
Seems like cookies are disabled on this browser, please enable them to open this website
String Construction
You are viewing a single comment's thread. Return to all comments →
JavaScript Solution