본문 바로가기

Algorithm/프로그래머스 코딩테스트 문제풀이전략36

[프로그래머스] Lv.2 괄호 회전하기 https://school.programmers.co.kr/learn/courses/30/lessons/76502 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 사용 알고리즘스택문자열 분할풀이 import java.util.Stack;class Solution { static int answer = 0; public int solution(String s) { for(int i = 0; i stack = new Stack(); for(char c : tmp.toCharArray()) { .. 2024. 5. 14.
[프로그래머스] Lv.2 올바른 괄호 https://school.programmers.co.kr/learn/courses/30/lessons/12909 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 사용 알고리즘스택풀이 import java.util.*;class Solution { boolean solution(String s) { Stack stack = new Stack(); for(char c : s.toCharArray()) { if (!stack.isEmpty()) { if (stack.peek.. 2024. 5. 14.
[프로그래머스] Lv.1 완주하지 못한 선수 https://school.programmers.co.kr/learn/courses/30/lessons/42576 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 문제 접근 방법1. 참가자들의 이름과 등장횟수를 해쉬맵에 담아준다.2. 완주자들을 순회하며 해쉬맵에서 등장횟수 - 1을 해준다.3. 마지막으로 해쉬맵의 value값을 순회할 때 0이 아닌 값이 있다면, 해당 Key를 리턴해준다.import java.util.*;class Solution { public String solution(String[] participant, String[] compl.. 2024. 5. 6.
[프로그래머스] Lv.1 없는 숫자 더하기 https://school.programmers.co.kr/learn/courses/30/lessons/86051?language=java 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr  class Solution { public int solution(int[] numbers) { int answer = 0; boolean[] visited = new boolean[10]; for(int num : numbers) { visited[num] = true; } .. 2024. 5. 5.