You are viewing a single comment's thread. Return to all comments →
This is my solution in javascript:
let i = 0; let beautiful = false; let head = 0; while (i < s.length - 1) { let currentChar = BigInt(s.slice(0, i + 1)); let newString = currentChar.toString(); head = currentChar; while (newString.length < s.length) { currentChar += BigInt(1); newString += currentChar.toString(); // console.log(newString); } if (newString === s) { beautiful = true; break; } else { i++; } } if (beautiful) { console.log("YES " + head); } else { 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 →
This is my solution in javascript: