Tell us what’s happening:
Hello
I’m sure the tests are wrong because they aren’t the max combination possible from these numbers.
Maybe I’m just tired and cant understand what I did wrong
See ya
Your code so far
const bubbleSort = (inputArr) => {
let len = inputArr.length;
for (let i = 0; i < len; i++) {
for (let j = 0; j < len; j++) {
if (inputArr[j] > inputArr[j + 1]) {
let tmp = inputArr[j];
inputArr[j] = inputArr[j + 1];
inputArr[j + 1] = tmp;
}
}
}
return inputArr;
};
const maxCombine=(xs)=>{
let str = xs.join("");
let arr = []
for(let i=0;i<str.length;i++){
arr.push(str[i])
}
let newArr = bubbleSort(arr);
return newArr.reverse().join("");
}
console.log(maxCombine([1, 34, 3, 98, 9, 76, 45, 4]));
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
.
Challenge: Largest int from concatenated ints
Link to the challenge: