๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Algoritm/Quiz-Solutions7

[Programmers/์ฝ”๋”ฉํ…Œ์ŠคํŠธ์—ฐ์Šต/์ •๋ ฌ] k๋ฒˆ์งธ ์ˆ˜ ๋ฌธ์ œ https://programmers.co.kr/learn/courses/30/lessons/42748 ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์—ฐ์Šต - K๋ฒˆ์งธ์ˆ˜ [1, 5, 2, 6, 3, 7, 4] [[2, 5, 3], [4, 4, 1], [1, 7, 3]] [5, 6, 3] programmers.co.kr ๋‚ด ํ’€์ด import java.util.Arrays; public int[] solution(int[] array, int[][] commands) { int[] answer = new int[commands.length]; for(int i=0; i 2020. 8. 30.
[Leetcode 1] two Sum 1) Question https://leetcode.com/problems/two-sum/ Two Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 2) My Solution class Solution { public int[] twoSum(int[] nums, int target) { int[] answer=new int[2]; int count=nums.length; for(int i=0; i ์˜คํžˆ๋ ค ์‹œ๊ฐ„์†Œ๋ชจ๊ฐ€ ๋” ๋˜๋Š” ๊ฒฝ์šฐ ์กด์žฌ! >> Tip! ๋ฐ”๋กœ.. 2020. 8. 2.
[๋ฐฑ์ค€ 2156] ํฌ๋„์ฃผ ์‹œ์‹ (Java) - DP [๋ฌธ์ œ๋งํฌ] https://www.acmicpc.net/problem/2156 2156๋ฒˆ: ํฌ๋„์ฃผ ์‹œ์‹ ํšจ์ฃผ๋Š” ํฌ๋„์ฃผ ์‹œ์‹ํšŒ์— ๊ฐ”๋‹ค. ๊ทธ ๊ณณ์— ๊ฐ”๋”๋‹ˆ, ํ…Œ์ด๋ธ” ์œ„์— ๋‹ค์–‘ํ•œ ํฌ๋„์ฃผ๊ฐ€ ๋“ค์–ด์žˆ๋Š” ํฌ๋„์ฃผ ์ž”์ด ์ผ๋ ฌ๋กœ ๋†“์—ฌ ์žˆ์—ˆ๋‹ค. ํšจ์ฃผ๋Š” ํฌ๋„์ฃผ ์‹œ์‹์„ ํ•˜๋ ค๊ณ  ํ•˜๋Š”๋ฐ, ์—ฌ๊ธฐ์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋‘ ๊ฐ€์ง€ ๊ทœ์น™์ด ์žˆ๋‹ค. ํฌ๋„์ฃผ ์ž”์„ ์„ ํƒํ•˜๋ฉด ๊ทธ ์ž”์— ๋“ค์–ด์žˆ๋Š” ํฌ๋„์ฃผ๋Š” ๋ชจ๋‘ ๋งˆ์…”์•ผ ํ•˜๊ณ , ๋งˆ์‹  ํ›„์—๋Š” ์›๋ž˜ ์œ„์น˜์— ๋‹ค์‹œ ๋†“์•„์•ผ ํ•œ๋‹ค. ์—ฐ์†์œผ๋กœ ๋†“์—ฌ ์žˆ๋Š” 3์ž”์„ ๋ชจ๋‘ ๋งˆ์‹ค ์ˆ˜๋Š” ์—†๋‹ค. ํšจ์ฃผ๋Š” ๋  ์ˆ˜ ์žˆ๋Š” ๋Œ€๋กœ ๋งŽ์€ ์–‘์˜ ํฌ๋„์ฃผ๋ฅผ ๋ง›๋ณด๊ธฐ ์œ„ํ•ด์„œ ์–ด๋–ค ํฌ๋„์ฃผ ์ž”์„ ์„ ํƒํ•ด์•ผ ํ• ์ง€ ๊ณ  www.acmicpc.net [ํ’€์ด์†Œ์Šค] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 .. 2020. 5. 7.
[๋ฐฑ์ค€ 1260] DFS์™€ BFS (Java) - DFS,BFS [๋ฌธ์ œ๋งํฌ] https://www.acmicpc.net/problem/1260 1260๋ฒˆ: DFS์™€ BFS ์ฒซ์งธ ์ค„์— ์ •์ ์˜ ๊ฐœ์ˆ˜ N(1 ≤ N ≤ 1,000), ๊ฐ„์„ ์˜ ๊ฐœ์ˆ˜ M(1 ≤ M ≤ 10,000), ํƒ์ƒ‰์„ ์‹œ์ž‘ํ•  ์ •์ ์˜ ๋ฒˆํ˜ธ V๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๋‹ค์Œ M๊ฐœ์˜ ์ค„์—๋Š” ๊ฐ„์„ ์ด ์—ฐ๊ฒฐํ•˜๋Š” ๋‘ ์ •์ ์˜ ๋ฒˆํ˜ธ๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ์–ด๋–ค ๋‘ ์ •์  ์‚ฌ์ด์— ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๊ฐ„์„ ์ด ์žˆ์„ ์ˆ˜ ์žˆ๋‹ค. ์ž…๋ ฅ์œผ๋กœ ์ฃผ์–ด์ง€๋Š” ๊ฐ„์„ ์€ ์–‘๋ฐฉํ–ฅ์ด๋‹ค. www.acmicpc.net [ํ’€์ด ์†Œ์Šค] 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 5.. 2020. 5. 7.