[Algorithm] 점의 위치 구하기

yeah·2023년 10월 18일

Algorithm

목록 보기
17/27
post-thumbnail

Mission.

작성한 답

function solution(dot) {
    const x = dot[0];
    const y = dot[1];
    if (x > 0 && y > 0) {
        return 1;
    } else if (x < 0 && y > 0) {
        return 2;
    } else if (x < 0 && y < 0) {
        return 3;
    } else {
        return 4;
    }
}

참고 자료

https://school.programmers.co.kr/learn/courses/30/lessons/120841

profile
기록과 회고

0개의 댓글