java

    옹알이(1)

    프로그래머스 - 코딩테스트 입문 - [Lv.0] 옹알이(1) [풀이 기록] 2023/01/21 - Java 풀이 완료 [작성 코드] Java 더보기 class Solution { public int solution(String[] babbling) { int answer = 0; String[] able = {"aya", "ye", "woo", "ma"}; for(int b=0; b

    위장

    위장

    프로그래머스 - 해시 - [Lv.2] 위장 [풀이 기록] ????/??/?? - Java 풀이 완료 2022/07/26 - C++ 풀이 완료 [작성 코드] Java 더보기 import java.util.*; class Solution { public int solution(String[][] clothes) { int answer = 0; HashMap mp = new HashMap(); for(int i=0;i (얼굴 경우의 수) * (상의 경우의 수) * ... - 1 = answer C++ 더보기 #include #include #include using namespace std; int solution(vector clothes) { int answer = 1; unordered_map m; fo..

    전화번호 목록

    전화번호 목록

    프로그래머스 - 해시 - [Lv.2] 전화번호 목록 [풀이 기록] ????/??/?? - Java 풀이 완료 2022/07/26 - C++ 풀이 완료(해시 사용x) 2022/07/26 - C++ 풀이 완료(해시 사용) [작성 코드] Java 더보기 import java.util.*; class Solution { public boolean solution(String[] phone_book) { boolean answer = true; Arrays.sort(phone_book); for(int i=0;i

    완주하지 못한 선수

    완주하지 못한 선수

    프로그래머스 - 해시 - [Lv.1] 완주하지 못한 선수 [풀이 기록] ????/??/?? - Java 풀이 완료 2022/07/25 - C++ 풀이 완료 [작성 코드] Java 더보기 import java.util.*; class Solution { public String solution(String[] participant, String[] completion) { Arrays.sort(participant); Arrays.sort(completion); int i=0; for(i=0; isecond > 0){ answer = iter->first; break; } } return answer; } ✔️해시를 이용해 시간을 절약 ❌map보다 unordered_map을 이용하는 것이 더 빠르게 탐색 ..

    K번째수

    K번째수

    프로그래머스 - 정렬 - [Lv.1] K번째수 [풀이 기록] ????/??/?? - Java 풀이 완료 2022/07/19 - C++ 풀이 완료 [작성 코드] Java 더보기 import java.util.*; class Solution { public int[] solution(int[] array, int[][] commands) { int[] answer = new int[commands.length]; for(int p=0; p

    H-Index

    H-Index

    프로그래머스 - 정렬 - [Lv.2] H-Index [풀이 기록] ????/??/?? - Java 풀이 완료 2022/07/19 - C++ 풀이 완료 [작성 코드] Java 더보기 import java.util.*; class Solution { public int solution(int[] citations) { int answer = 0; Arrays.sort(citations); for(int i=0; i= h){ answer = h; break; } } return answer; } } ✔️정렬 후 조건에 맞는 h 찾기 C++ 더보기 #include #include #include using namespace std; int solution(vector citations) { int answer ..