일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 왓챠피디아 클론 코딩
- string과 stringbuilder
- 배열 순환 문제 공식
- 티스토리챌린지
- stringbuilder란
- 배열 순환 자바
- 경우의 수 자바
- 소인수분해 구하는 공식
- 스프링부트 의존성 설정
- 개미 군단 자바
- string과 stringbuilder의 차이
- 스프링 부트 프로젝트 세팅
- string과 stringbuilder 성능 최적화
- 배열 순환
- 프로그래머스 문자열 정렬하기(1)
- 자바 소인수분해
- 자바 합성수 찾기
- spring boot 배너 설정
- string과 stringbuilder 성능 차이
- string과 stringbuilder의 차이점
- 오블완
- 모스부호(1) 자바
- 프로그래머스 공 던지기 게임
- 스프링 부트 배너 설정
- 펙토리얼
- 외계행성의 나이 자바
- 프로그래머스
- 숨어있는 숫자의 덧셈 (1) 자바
- 접속 url 출력
- 자바 팩토리얼
- Today
- Total
목록분류 전체보기 (244)
여름 언덕에서 배운 것

LinkedHashSet 은 중복제거 그리고 순서도 유지해줌! HashSet은 중복제거는 되는데 순서 유지가 안됌 import java.util.*;class Solution { public int[] solution(int[] arr, int k) { Set resultList = new LinkedHashSet(); // 중복 제거하며 최대 k개까지 수집 for (int i = 0; i newResultList = new ArrayList(resultList); while (newResultList.size()
다른 사람 풀이 중에 stack LIFO(Last-In-First-Out) 구조 를 이용해서 푼게 있었다.stack.peek()는 스택의 맨 위(마지막)에 있는 요소를 가져온다.import java.util.Stack;class Solution { public int[] solution(int[] arr) { Stack stack = new Stack(); for (int no : arr) { if (!stack.isEmpty() && no == stack.peek()) { stack.pop(); } else { stack.push(no); } } ..
정규식을 이용import java.util.*;class Solution { public String[] solution(String myStr) { String [] splits = myStr.split("[abc]+"); List str = new ArrayList(); for(String s : splits){ if(!s.isEmpty()){ str.add(s); } } if(str.isEmpty()){ return new String[]{"EMPTY"}; } return str.toArray(..
class Solution { public String solution(String rny_string) { String answer = ""; if(rny_string.contains("m")){ answer = rny_string.replace("m","rn"); }else{ answer = rny_string; } return answer; }}m 을 rn 으로 바꾸기~
A를 B로 , B를 A로 바꿔서 주어진 pat 문자열이 포함되어있는지 확인하는 문제였다.class Solution { public int solution(String myString, String pat) { int answer = 0; String[] str = myString.split(""); String change = ""; for(String s : str){ if(s.equals("A")){ change+= "B"; }else{ change+= "A"; } } answer = change.contain..
테스트만 통과하고 제출하면 다 틀렸길래생각해보니 x 기준으로 split 하면 공백이 있는데공백이 있는 상태에서 오름차순 정렬하면 ("","","",a,b,c)가 되버림공백을 없애줘야한다.import java.util.*;class Solution { public String[] solution(String myString) { String[] answer = myString.split("x"); List str = new ArrayList(); for(String s : answer){ if(!s.isEmpty()){ str.add(s); } } //오름차순 ..
import java.util.*;class Solution { public int[] solution(String myString) { String [] xArr = myString.split("x",-1); List str = new ArrayList(); for(String s : xArr){ str.add(s.length()); } int [] answer = str.stream().mapToInt(Integer::intValue).toArray(); return answer; }}원래는 split("x") 로만 해서 틀렸는데 찾아보니 마지막이 공백이면 포함을 안시..
indexOf 함수를 이해하는데 시간이 좀 걸렸다. class Solution { public int solution(String myString, String pat) { int answer = 0; int idx = myString.indexOf(pat); while(idx !=-1){ answer++; idx = myString.indexOf(pat,idx+1); } return answer; }} ✅ indexOf() 함수는 왼쪽에서 오른쪽으로 차례대로 탐색하는 함수🔍 indexOf()의 동작 방식 (기본 개념)int index = myString.indexOf("찾을 문자열", 시작..