Deep_Dev
article thumbnail
[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][JAVA]Level 2 : ์ˆซ์ž์˜ ํ‘œํ˜„

https://school.programmers.co.kr/learn/courses/30/lessons/12924 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ํˆฌํฌ์ธํ„ฐ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์‚ฌ์šฉํ•œ๋‹ค. class Solution { public int solution(int n) { int answer = 0; int sum = 0; int lt = 0; int[] arr = new int[n]; for(int i=0; i

article thumbnail
[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][JAVA]Level 2 : ์ด์ง„ ๋ณ€ํ™˜ ๋ฐ˜๋ณตํ•˜๊ธฐ

https://school.programmers.co.kr/learn/courses/30/lessons/70129 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ๋ชจ๋“  0 ์ œ๊ฑฐ ํ›„ -> ์ œ๊ฑฐํ•œ๋งŒํผ ์นด์šดํŠธ ์ œ๊ฑฐ ๋œ ๋ฌธ์ž์—ด ๊ธธ์ด๋ฅผ ๋‹ค์‹œ 2์ง„์ˆ˜๋กœ -> ๋ณ€ํ™˜ํšŸ์ˆ˜ ์นด์šดํŠธ ์ด ๊ณผ์ •์„ ๋ฌธ์ž์—ด s์˜ ๊ธธ์ด๊ฐ€ 2๊นŒ์ง€ ( s.length() > 1 ) ๋ฐ˜๋ณตํ•˜๋ฉด ๋œ๋‹ค. class Solution { public int[] solution(String s) { int[] answer = new int[2]; int cnt = 0; int zeroCount = 0; while(s...

article thumbnail
[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][JAVA]Level 2 : ์˜ฌ๋ฐ”๋ฅธ ๊ด„ํ˜ธ

https://school.programmers.co.kr/learn/courses/30/lessons/12909 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ์˜ค๋žœ๋งŒ์— Stack๋งŒ ์จ์„œ ์—ฐ์Šตํ•œ๋“ฏํ•˜๋‹ค. import java.util.*; class Solution { boolean solution(String s) { boolean answer = true; Stack stack = new Stack(); for(int i=0; i

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][JAVA] Level 2 : ์ตœ์†Ÿ๊ฐ’ ๋งŒ๋“ค๊ธฐ

https://school.programmers.co.kr/learn/courses/30/lessons/12941 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr 1. Arrays.sort() ์‚ฌ์šฉ import java.util.*; class Solution { public int solution(int []A, int []B) { int answer = 0; Arrays.sort(A); Arrays.sort(B); int j = B.length-1; for(int i=0; i

article thumbnail
[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][JAVA]Level 2 : JadenCase ๋ฌธ์ž์—ด ๋งŒ๋“ค๊ธฐ

https://school.programmers.co.kr/learn/courses/30/lessons/12951 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ํ’€์ด์‹œ ์ฃผ์˜ํ•  ์  : ๊ณต๋ฐฑ์ด ์—ฐ์†์œผ๋กœ ๋‚˜์˜ฌ ์ˆ˜๋„ ์žˆ์œผ๋ฏ€๋กœ, split(" ") ์‚ฌ์šฉ์‹œ ์ฃผ์˜ ํ•ด์•ผํ•œ๋‹ค. class Solution { public String solution(String s) { String answer = ""; for(int i=0; i

article thumbnail
[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][JAVA]Level 2 : ์ตœ๋Œ“๊ฐ’๊ณผ ์ตœ์†Ÿ๊ฐ’

Level 2์—์„œ ์•„๋งˆ ์ œ์ผ ์‰ฌ์šด๋ฌธ์ œ์ผ ๊ฒƒ์ด๋‹ค. import java.util.*; class Solution { public String solution(String s) { String answer = ""; String[] str=s.split(" "); ArrayList list = new ArrayList(); for(int i=0; i import java.util.*; class Solution { public String solution(String s) { tring[] tmp = str.split(" "); int min, max, n; min = max = Integer.parseInt(tmp[0]); for (int i = 1; i < tmp.length; i++) ..

article thumbnail
[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][JAVA]Level 1 : ์˜น์•Œ์ด (2)

https://school.programmers.co.kr/learn/courses/30/lessons/133499 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ์ด ๋ฌธ์ œ๋ฅผ ์ฒ˜์Œ ๋ดค์„๋•Œ๋Š” ์ž˜ ์•ˆ ํ’€๋ ค์„œ ๋„˜์–ด๊ฐ”๋‹ค๊ฐ€ ์˜ค๋žœ๋งŒ์— ๋‹ค์‹œ ๋ดค๋Š”๋ฐ ์–ด๋–ป๊ฒŒ ์ ‘๊ทผํ•ด์•ผํ• ์ง€ ๋ฐ”๋กœ ์ƒ๊ฐ๋‚ฌ๋‹ค. babbling์„ ๋Œ๋ฉด์„œ aya, ye, woo, ma๋ฅผ ๋ชจ๋‘ ์†Œ๊ฑฐํ•ด์ฃผ๋Š”๊ฒƒ์œผ๋กœ ํŒ๋ณ„ํ•˜๋Š”๊ฒƒ์ด๋‹ค. replace๋ฅผ ์‚ฌ์šฉํ•˜๋Š”๊ฒƒ ์ฃผ์˜ํ• ์ ์€, ๊ฐ™์€ ๋ฐœ์Œ์€ 2๋ฒˆ ์—ฐ์† ๋งํ•  ์ˆ˜ ์—†์–ด์„œ, ์šฐ์„ ์ ์œผ๋กœ ํŒ๋ณ„ํ•ด์ฃผ๋Š”๊ฒƒ๊ณผ.. replace(babbling[i], "") ์ด๋ ‡๊ฒŒ ๋ฐ”๋กœ ๋นˆ๊ณต๋ฐฑ์œผ๋กœ ๋ฐ”๋กœ ํ•˜๋ฉด ์•ˆ๋˜๋Š” ..

article thumbnail
[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][JAVA]Level 1 : ๋‘˜๋งŒ์˜ ์•”ํ˜ธ

https://school.programmers.co.kr/learn/courses/30/lessons/155652 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr skip์— ํ•ด๋‹นํ•˜๋Š” ๋ฌธ์ž๊ฐ€ ์žˆ๊ณ , z๊ฐ€ ๋„˜์–ด๊ฐ€๋ฉด a๋กœ ๋Œ์•„์˜ค๋Š”๊ฒƒ๋งŒ ์‹ ๊ฒฝ์“ฐ๋ฉด ๋œ๋‹ค. class Solution { public String solution(String s, String skip, int index) { String answer = ""; char[] ch = s.toCharArray(); for(int i=0; i 'z') { ch[i] -= 26; } while (skip.co..