본문 바로가기

코딩테스트/Coding Bat

[코딩뱃] [자바] warmup - 1단계 : sleepIn 문제

728x90
728x90

https://codingbat.com/prob/p187868

 

CodingBat Java Warmup-1 sleepIn

The parameter weekday is true if it is a weekday, and the parameter vacation is true if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return true if we sleep in.sleepIn(false, false) → truesleepIn(true, false) → falseslee

codingbat.com



=문제 번역=

매개변수 weekday는 평일이면 참이고 휴가 중이면 휴가 매개변수는 참입니다.

평일이 아니거나 휴가 중이면 잠을 자요. 우리가 잠을 자면 true를 반환합니다.

 

=해설=

public boolean sleepIn(boolean weekday, boolean vacation) {

  boolean result = !weekday||vacation;
  return result;
  
}

 

아무래도 코딩뱃 문제들이 영어로 이루어져있다보니까, 접근성이 많이 떨어져서 진행할지 고민을 많이했는데,

백준 기본문제들보다 조금 더 쉬운 것 같아서 진행할 예정이다.

(어려운 문제는 선생님한테 질문하기)

728x90