Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- 건강
- 운동기록
- binary search
- db
- MySQL
- COS PRO
- 이분탐색
- oracle
- SQL
- 알고리즘
- BOJ
- BFS
- SWEA
- 코딩테스트
- 시뮬레이션
- math
- DP
- 프로그래머스
- 자바
- dfs
- priorityqueue
- Java
- 러닝일지
- 백준
- 투포인터
- 문제풀이
- 코테
- 문제해결
- greedy
- 문자열
Archives
- Today
- Total
슈콩
[프로그래머스] Lv.2 모음사전 본문


[문제]
https://school.programmers.co.kr/learn/courses/30/lessons/84512
프로그래머스
SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
[소스 코드]
import java.util.*;
class Solution {
List<String> list;
String[] w = {"A","E","I","O","U"};
public int solution(String word) {
int answer = 0;
list = new ArrayList<>();
for(int i=1;i<=5;i++){
make(0,i,"");
}
Collections.sort(list);
return list.indexOf(word)+1;
}
private void make(int cnt,int max,String s){
if(cnt==max){
list.add(s);
return;
}
for(int i=0;i<5;i++){
make(cnt+1,max,s+w[i]);
}
}
}'Algorithms > Programmers' 카테고리의 다른 글
| [프로그래머스] Lv.2 k진수에서 소수 개수 구하기 (0) | 2025.10.16 |
|---|---|
| [프로그래머스] Lv.2 뒤에 있는 큰 수 찾기 (0) | 2025.10.16 |
| [프로그래머스] Lv.2 방문 길이 (0) | 2025.10.16 |
| [프로그래머스] Lv.2 타겟 넘버 (0) | 2025.10.15 |
| [프로그래머스] Lv.2 롤케이크 자르기 (0) | 2025.10.15 |