https://school.programmers.co.kr/learn/courses/30/lessons/120886
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
class Solution {
public int solution(String before, String after) {
int answer = 0;
String[] beforeArr = before.split("");
String[] afterArr = after.split("");
int length = before.length();
int[] afterCheck = new int[length];
int count = 0;
for(int i=0;i<length;i++){
for(int j=0;j<length;j++){
if(afterCheck[j]==0 &&beforeArr[i].equals(afterArr[j])){
afterCheck[j]=1;
count++;
break;
}
}
}
if(count==length){
answer = 1;
}
return answer;
}
}
'JAVA' 카테고리의 다른 글
[프로그래머스/자바] 안전지대 (0) | 2023.09.04 |
---|---|
[프로그래머스/자바] 캐릭터의 좌표 (0) | 2023.09.03 |
[프로그래머스/자바] 다항식 더하기 (0) | 2023.09.01 |
구름톤 챌린지 15일차 - 과일 구매 (0) | 2023.09.01 |
[프로그래머스/자바] 자릿수 더하기 (0) | 2023.08.31 |
댓글