function getMinNum(str = '2354363463',n = 2){ let arr = []; let splitArr = str.split('') for(let i = 0;i < splitArr.length - n + 1;i++){ let item = splitArr.splice(i,n); arr.push(Number(splitArr.join(''))); splitArr.splice(i,0,...item); } return Math.min(...arr); }