강의

멘토링

커뮤니티

Inflearn Community Q&A

workstation199611109's profile image
workstation199611109

asked

Introduction to Javascript Algorithm Problem Solving (Coding Test Preparation)

3. Special Sort (Bubble Sort Application)

역시나 좌측으로 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!
workstation199611109's profile image
workstation199611109

asked

Ask a question