Inflearn Community Q&A
역시나 좌측으로 Special Sort 되고 있습니다...
Written on
·
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;
}
javascript코테 준비 같이 해요!
Answer
This question is waiting for answers
Be the first to answer!





