Note/물음표 모음
여러개의 if문
ilyadelavie
2022. 6. 13. 13:19
if문 여러개와 if-else if 문의 차이점
for(int i=0; i<len; i++){
Node temp = Q.poll();
if(temp.lt==null && temp.rt==null) return level;
if(temp.lt !=null) Q.offer(temp.lt);
if(temp.rt !=null) Q.offer(temp.rt);
}
for(int i=0; i<len; i++){
Node temp = Q.poll();
if(temp.lt==null && temp.rt==null) return level;
else if(temp.lt!=null) return 1;
}