20230920 공 던지기

이셀·2023년 9월 24일
0

공 던지기

function solution(numbers, k) {
    let catchBall = 1
    for(let i = 0 ; i < k-1 ; i ++) {
        catchBall+=2
        if(catchBall > numbers.length) {
            catchBall-=numbers.length
        }
    }
    return catchBall
}
profile
프론트엔드 개발 과정을 기록 중입니다:)

0개의 댓글