정답 틀림

덜된 수달 25-04-14
수정 삭제
정보처리기사 실기 2024년 2회
17. 다음 Java로 구현된 프로그램을 분석하여 그 실행 결과를 쓰시오.
public class Main {
	public static String rf(String str, int index, boolean[] seen) {
		if(index < 0) return "";
		char c = str.charAt(index);
		String result = rf(str, index-1, seen);
		if(!seen[c]) {
			seen[c] = true;
			return c + result;
		}
		return result;
	}
	public static void main(String[] args) {
		String str = "abacabcd";
		int length = str.length();
		boolean[] seen = new boolean[256];
		System.out.print(rf(str, length-1, seen));
	}
}

정답 abcd 입니다

댓글
0 9

모든 문제들의 저작권은 원저작권자에게 있습니다. 본 사이트는 웹상에 공개되어 있는 문제만 모아서 보여드립니다.
저작권 안내   데이터 보호 안내   제휴 문의

copyright 2025 뉴비티::새로운 CBT 시스템 - newbt.kr