https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWZ2IErKCwUDFAUQ SW Expert Academy SW ํ๋ก๊ทธ๋๋ฐ ์ญ๋ ๊ฐํ์ ๋์์ด ๋๋ ๋ค์ํ ํ์ต ์ปจํ ์ธ ๋ฅผ ํ์ธํ์ธ์! swexpertacademy.com 3๊ฐ ํฉ์ ๊ตฌํ ์ ์๋ ๋ชจ๋ ๊ฒฝ์ฐ์ ์๋ฅผ HashSet์ ๋ฃ์ด์ ์ค๋ณต์ ์ ๊ฑฐํ๊ณ Set์ ๊ฐ๋ค์ ArrayList์ ๋ฃ์ด ์ ๋ ฌํ์ฌ, ๋์์ 5๋ฒ์งธ ๊ฐ์ ์ถ์ถํ๋ค. import java.util.*; class Solution{ public static void main(String args[]) throws Exception{ Scanner kb = new Scanner(System.in); in..
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV14jJh6ACYCFAYD SW Expert Academy SW ํ๋ก๊ทธ๋๋ฐ ์ญ๋ ๊ฐํ์ ๋์์ด ๋๋ ๋ค์ํ ํ์ต ์ปจํ ์ธ ๋ฅผ ํ์ธํ์ธ์! swexpertacademy.com ์ ๋ ฅ๋ฐ์ ๋ฌธ์์ด๋ค์ ์ข ๋ฅ = 10์ข ๋ฅ ๊ฐ ๋ฌธ์์ด๋ง๋ค ๋ช๋ฒ ์ ๋ ฅ๋ฐ์๋์ง ์นด์ดํธํ cnt ๋ฐฐ์ด ์์ฑ ( 0์ผ๋ก ์ด๊ธฐํ ) ๊ฐ ๋ฌธ์์ด์ด ๊ฐ๊ฐ ๋ช๋ฒ ๋ฑ์ฅํ๋์ง๋ฅผ ์ธ์, ZRO ๋ถํฐ NIN๊น์ง ์์๋๋ก cntํ๋ ๋งํผ ์ถ๋ ฅ ๋ฐ๋ณต ๊ทผ๋ฐ ๋ค ํ์ด๋๊ณ ์ฝ์ง์ ํ ์ด์ ๊ฐ, ์ ๋ ฅ ์ค๋ช ์ ๋ณด๋ฉด "๊ทธ ๋ค์ ์ค์ #๊ธฐํธ์ ํจ๊ป ํ ์คํธ ์ผ์ด์ค์ ๋ฒํธ๊ฐ ์ฃผ์ด์ง๊ณ " ์ด๊ฑฐ๋ณด๊ณ print๋ก ์ถ๋ ฅํ๋ผ๋๊ฑด์ค์์๋๋ฐ ์ ๋ ฅ์ผ๋ก ๋ฐ๋๊ฑฐ๋๊น..
https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AV139KOaABgCFAYh&categoryId=AV139KOaABgCFAYh&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=ALL&select-1=3&pageSize=10&pageIndex=5 SW Expert Academy SW ํ๋ก๊ทธ๋๋ฐ ์ญ๋ ๊ฐํ์ ๋์์ด ๋๋ ๋ค์ํ ํ์ต ์ปจํ ์ธ ๋ฅผ ํ์ธํ์ธ์! swexpertacademy.com ๋ฌธ์ ์ค๋ช ์ ๊ธด๋ฐ ๊ทธ๋ฅ ์ ๋ ฌ ๋ฌธ์ ์ด๋ค. 100๊ฐ๋ฅผ ๋ด์ ๋ฐฐ์ด์, ํํํํ ํ์๋งํผ [์ ๋ ฌ] - ์ต๋๊ฐ์ -1 - ์ต์๊ฐ์ +1 ๋ฐ๋ณตํด์ฃผ๊ณ ํ..
https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AW2y6n3qPXQDFATy&categoryId=AW2y6n3qPXQDFATy&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=ALL&select-1=3&pageSize=10&pageIndex=4 SW Expert Academy SW ํ๋ก๊ทธ๋๋ฐ ์ญ๋ ๊ฐํ์ ๋์์ด ๋๋ ๋ค์ํ ํ์ต ์ปจํ ์ธ ๋ฅผ ํ์ธํ์ธ์! swexpertacademy.com split์ ์ด์ฉํด์ ๊ณต๋ฐฑ๊ธฐ์ค์ผ๋ก ๋๋ ์ ๊ฐ ๋ฐฐ์ด์ ์ฒซ ๋ฌธ์๋ฅผ ๋๋ฌธ์ํํ์ฌ ๋ด์ผ๋ฉด ๋๋๋ฐ, ์ด์ํ๊ฒ int t๋ฅผ ์ ๋ ฅ๋ฐ์๋ง์ string ..
https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AW37UDPKCgQDFATy&categoryId=AW37UDPKCgQDFATy&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=JAVA&select-1=3&pageSize=10&pageIndex=4 SW Expert Academy SW ํ๋ก๊ทธ๋๋ฐ ์ญ๋ ๊ฐํ์ ๋์์ด ๋๋ ๋ค์ํ ํ์ต ์ปจํ ์ธ ๋ฅผ ํ์ธํ์ธ์! swexpertacademy.com ์ ๋ ฅ๋ ์ซ์์ค์์ ํ์๊ฐ๋ก ์ ๋ ฅ๋๊ฒ์ ๊ฐฏ์.. Stack์ ์ด์ฉํด์ ์์ผ๋ฉด push, ์์ผ๋ฉด pop import java.util.Sca..

๐กBFS BFS๋ ๋๋น ์ฐ์ ํ์์ผ๋ก, ๋ฃจํธ ๋ ธ๋์์ ํ์์ ์์ํ์ฌ ๊ฐ์ ๋ ๋ฒจ์ ์๋ ๋ ธ๋๋ฅผ ๋ชจ๋ ํ์ํ ๋ค์ ํ์ ๋ ๋ฒจ๋ก ๋ด๋ ค๊ฐ ๋ ๋ชจ๋ ํ์์ ์งํํ๋ค๊ฐ, ๋ ์ด์ ํ์ํ ๋ ธ๋๊ฐ ์์ ๋ ํ์์ ๋ฉ์ถ๋ ๋ฐฉ์์ผ๋ก ๋์ํ๋ค. ํ๋ฅผ ์ด์ฉํ์ฌ ๊ตฌํํ๋ค. ๐ก BFS ์ฝ๋๊ตฌํ import java.util.*; class Node{ int data; Node lt,rt; public Node(int val){ data=val; lt=rt=null; } } public class Solution { Node root; public void BFS(Node root) { Queue Q=new LinkedList(); Q.offer(root); int L=0; while(!Q.isEmpty()){ int len=Q..

https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV7GLXqKAWYDFAXB SW Expert Academy SW ํ๋ก๊ทธ๋๋ฐ ์ญ๋ ๊ฐํ์ ๋์์ด ๋๋ ๋ค์ํ ํ์ต ์ปจํ ์ธ ๋ฅผ ํ์ธํ์ธ์! swexpertacademy.com ์์ง ๊ทธ๋ฆผ๋ฌธ์ ์ ์ต์ํ์ง ์์๋ฐ, ๊ณ ๋ฏผํ๋ค๊ฐ ๋ง๋ฆ๋ชจ๋ฅผ ๋๋ ์ ๊ตฌํ๋ฉด ๋๋ค. ๊ฐ์ด๋ฐ ๊ฐ๋ก์ค์ ํฌํจํ์ฌ ์๋จ, ๊ทธ๋ฆฌ๊ณ ํ๋จ์ ์ผ๊ฐํ ๋ถ๋ถ. import java.util.Scanner; class Solution{ public static void main(String args[]) throws Exception{ Scanner kb = new Scanner(System.in); int t = kb.n..
https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AWicMVWKTuMDFAUL&categoryId=AWicMVWKTuMDFAUL&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=ALL&select-1=3&pageSize=10&pageIndex=3 SW Expert Academy SW ํ๋ก๊ทธ๋๋ฐ ์ญ๋ ๊ฐํ์ ๋์์ด ๋๋ ๋ค์ํ ํ์ต ์ปจํ ์ธ ๋ฅผ ํ์ธํ์ธ์! swexpertacademy.com ์ฃผ์ด์ง ๋ฌธ์ ์ค์ ์ฌ๋๋ค์ด ๊ฐ๊ฐ ๋ช๋ฌธ์ ์ฉ ๋ง์ท๋์ง, ์ธ์์ ๋ง๋ answer 1์ฐจ์๋ฐฐ์ด์ ์์ฑํ๊ณ arr[i] ํ์ ๋ฐ๋ณตํ๋ฉด์ ๊ทธ ์ฌ๋์ด ๋ฌธ..