You are viewing a single comment's thread. Return to all comments →
function encryption(s: string): string { const newS = s.replace(/ /g, ""); let result = ""; let rows = Math.floor(Math.sqrt(newS.length)); let columns = Math.ceil(Math.sqrt(newS.length)); if (rows * columns < newS.length) { rows = Math.max(rows, columns); columns = Math.max(rows, columns); } for (let i = 0; i < columns; i++) { for (let j = 0; j < rows; j++) { if (i + columns * j < newS.length) { result += newS[i + columns * j]; } } result += " "; } return result; }
Seems like cookies are disabled on this browser, please enable them to open this website
Encryption
You are viewing a single comment's thread. Return to all comments →