function solution(n, k, card) {
let answer = [];
let n = card.length;
card.sort((a, b) => b - a);
for (let i = 0; i < n; i++) {
for (let j = 0; j < n; j++) {
for (let s = 0; s < n; s++) {
if (j !== i && s !== i && s !== j) {
answer.push(card[i] + card[j] + card[s]);
break;
}
}
}
}
return answer[k - 1];
}
let arr = [13, 15, 34, 23, 45, 65, 33, 11, 26, 42];
console.log(solution(10, 3, arr));