본문 바로가기
코딩테스트 연습/프로그래머스 Lv.0

프로그래머스 코딩테스트 lv.0 - 점의 위치 구하기. (Java)

by 트레비봄 2023. 8. 1.
728x90

문제 설명 + 입출력 예

 

class Solution {
    public int solution(int[] dot) {
        int answer = 0;
        if(dot[0] > 0) 
            if(dot[1] > 0) answer = 1;
            else answer = 4;
        
        else if(dot[1] > 0) answer = 2;
            else answer = 3;

        return answer;
    }
}

* 점의 위치 구하기 라는 문제.

* 풀만 했다는 느낌..

 

230801 학습.

728x90