[프로그래머스 자바] 20. 조건 문자열

김건우's avatar
Apr 06, 2025
[프로그래머스 자바] 20. 조건 문자열

문제

notion image

내가 푼 코드

notion image
public class Solution { public int solution(String ineq, String eq, int n, int m) { if (ineq.equals(">")) { if (eq.equals("=")) { return n >= m ? 1 : 0; } else if (eq.equals("!")) { return n > m ? 1 : 0; } } else if (ineq.equals("<")) { if (eq.equals("=")) { return n <= m ? 1 : 0; } else if (eq.equals("!")) { return n < m ? 1 : 0; } } return 0; } }
Share article

gunwoo