我用js写的
第一题
function findMax(val) {
const arr = val.split('');
const reg = /\d+/g;
const max = Math.max.apply(Math, val.match(reg));
console.log(max);
}
第三题
function main() {
for (let i = 0; i < size; i++) {
const b = a.concat();
b.splice(b.indexOf(a[i]), 1);
pailie(a[i], b);
}
}
function pailie(head, tail) {
for (let i = 0; i < tail.length; i++) {
if (tail.length === 1) {
console.log(head +''+ tail[0]);
} else {
const b = tail.concat();
b.splice(b.indexOf(tail[i]), 1);
pailie(head+''+tail[i], b);
}
}
}
第二题通过33%,惨的不谈