You are viewing a single comment's thread. Return to all comments →
Javascript solution:
function separateNumbers(s) { for (let i = 1; i <= Math.floor(s.length / 2); i++) { let t = s.slice(0, i); let n = t; let count = BigInt(t); while (t.length < s.length) { count++; t += count; } if (t === s) { console.log(`YES ${n}`); return; } } console.log("NO"); }
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
Javascript solution: