인프런 커뮤니티 질문&답변
역시나 좌측으로 Special Sort 되고 있습니다...
작성
·
165
0
function specialBubbleSort([length, numbers]) {
const nums = [...numbers];
for (let idx = 1; idx < length; idx++) {
for (let jdx = idx; jdx > 0; jdx--) {
if (nums[jdx] < 0 && nums[jdx-1] >= 0) [nums[jdx-1], nums[jdx]] = [nums[jdx], nums[jdx-1]]
}
}
return nums;
}
답변
답변을 기다리고 있는 질문이에요
첫번째 답변을 남겨보세요!





