
프로그래머스 Lv.0 조건 문자열개발자가 되기까지 (2023.08.16~2024.04.15)/[Algorithm] Programmers ver.Java2023. 12. 5. 01:06
Table of Contents
<Solution>
class Solution {
public int solution(String ineq, String eq, int n, int m) {
int answer = 0;
if (ineq.equals(">") && eq.equals("=")) {
answer = (n >= m) ? 1 : 0 ;
} else if (ineq.equals("<") && eq.equals("=")) {
answer = (n <= m) ? 1 : 0 ;
} else if (ineq.equals(">") && eq.equals("!")) {
answer = (n > m) ? 1 : 0 ;
} else if (ineq.equals("<") && eq.equals("!")) {
answer = (n < m) ? 1 : 0 ;
}
return answer;
}
}
728x90
@rlozlr :: 얼렁뚱땅 개발자
얼렁뚱땅 주니어 개발자
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!