-
๐ป ์๋ฐ ์๊ณ ๋ฆฌ์ฆ - ๋ง์ง๋ง ๋ ์์algorithm 2023. 9. 21. 10:35
๐ ๋ฌธ์ ์ค๋ช ์ ์ ๋ฆฌ์คํธ num_list๊ฐ ์ฃผ์ด์ง ๋, ๋ง์ง๋ง ์์๊ฐ ๊ทธ์ ์์๋ณด๋ค ํฌ๋ฉด ๋ง์ง๋ง ์์์์ ๊ทธ์ ์์๋ฅผ ๋บ ๊ฐ์ ๋ง์ง๋ง ์์๊ฐ ๊ทธ์ ์์๋ณด๋ค ํฌ์ง ์๋ค๋ฉด ๋ง์ง๋ง ์์๋ฅผ ๋ ๋ฐฐํ ๊ฐ์ ์ถ๊ฐํ์ฌ returnํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. ๐ ์ ํ ์ฌํญ 2 ≤ num_list์ ๊ธธ์ด ≤ 10 1 ≤ num_list์ ์์ ≤ 9 ๐ ๋ต์ class Solution { public int[] solution(int[] num_list) { int[] answer = new int[num_list.length+1]; for(int i=0; inum_list[num_list.length-2]) ? num_list[num_list.length-1]-num_list[num_list.leng..
-
๐ป ์๋ฐ ์๊ณ ๋ฆฌ์ฆ - ์ฃผ์ฌ์ ๊ฒ์2algorithm 2023. 9. 21. 10:21
๐ ๋ฌธ์ ์ค๋ช 1๋ถํฐ 6๊น์ง ์ซ์๊ฐ ์ ํ ์ฃผ์ฌ์๊ฐ ์ธ ๊ฐ ์์ต๋๋ค. ์ธ ์ฃผ์ฌ์๋ฅผ ๊ตด๋ ธ์ ๋ ๋์จ ์ซ์๋ฅผ ๊ฐ๊ฐ a, b, c๋ผ๊ณ ํ์ ๋ ์ป๋ ์ ์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. ์ธ ์ซ์๊ฐ ๋ชจ๋ ๋ค๋ฅด๋ค๋ฉด a + b + c ์ ์ ์ป์ต๋๋ค. ์ธ ์ซ์ ์ค ์ด๋ ๋ ์ซ์๋ ๊ฐ๊ณ ๋๋จธ์ง ๋ค๋ฅธ ์ซ์๋ ๋ค๋ฅด๋ค๋ฉด (a + b + c) × (a2 + b2 + c2 )์ ์ ์ป์ต๋๋ค. ์ธ ์ซ์๊ฐ ๋ชจ๋ ๊ฐ๋ค๋ฉด (a + b + c) × (a2 + b2 + c2 ) × (a3 + b3 + c3 )์ ์ ์ป์ต๋๋ค. ์ธ ์ ์ a, b, c๊ฐ ๋งค๊ฐ๋ณ์๋ก ์ฃผ์ด์ง ๋, ์ป๋ ์ ์๋ฅผ return ํ๋ solution ํจ์๋ฅผ ์์ฑํด ์ฃผ์ธ์. ๐ ์ ํ ์ฌํญ a, b, c๋ 1์ด์ 6์ดํ์ ์ ์์ ๋๋ค. ๐ ๋ต์ class Solution { public in..
-
๐ [Error] Error resolving template [like/65/find], template might not exist or might not be accessible by any of the configured Template Resolvers ...spring boot 2023. 9. 19. 16:46
json Error resolving template [like/65/find], template might not exist or might not be accessible by any of the configured Template Resolvers ๐ ๋ด์ฉ Spring boot์ ํ์๋ฆฌํ๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฉฐ ํด๋น ์๋ฌ๋ ๊ฒ์๊ธ์ ๋ค์ด๊ฐ์ ์ข์์๋ฅผ ๋๋ ๋์ง์ ๋ํ ๋ด์ฉ์ ๋ถ๋ฌ์ค๊ธฐ ์ํ ajax๋ฅผ ํต์ ํ ๋ ๋ฐ์ํ๋ค. ํด๋น ์๋ฌ๋ ํ์๋ฆฌํ ํ ํ๋ฆฟ ์ฌ์ฉ์ ๋ณดํต ๊ฒฝ๋ก๋ฅผ ์ฐพ์ง ๋ชปํด์ ๋ฐ์ํ๋๋ฐ ์ด๋ฒ ์ผ์ด์ค์๋ ํด๋นํ์ง ์์๋ค. ๐ ์์ธ JSON ํ์์ ๋ฐ์ดํฐ๋ฅผ ์ ์กํ๊ฑฐ๋ ์๋ต ๊ฐ์ผ๋ก ๋ฐ์ ๋, Java์์ ํด๋น JSON ๋ฐ์ดํฐ๋ฅผ Java ๊ฐ์ฒด๋ก ๋ณํํด์ผ ํ๋ค. ๊ทธ๋ฌํ ์ผ๋ จ์ ๊ณผ์ ์ @RequestBody, @..
-
๐ [Error] No setter found for the keyProperty 'id' in ...spring boot 2023. 9. 18. 23:55
๐ ๋ด์ฉ No setter found for the keyProperty 'id' in spring boot๋ก mapper ํ ์คํธ ํ๋ ์ค ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ๋ฐ์ดํฐ๋ ๋ค์ด๊ฐ๋๋ฐ ํ ์คํธ๊ฐ ์คํจ๋ก ๋ ์ ํ์ธํด๋ณด๋ ์์ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ค. ํด๋น ์ปฌ๋ผ์ ์๋์ผ๋ก ์ซ์๋ฅผ ์ฆ๊ฐ์ํค๋ auto_increment ์์ฑ์ผ๋ก ๋์ด ์์๋ค. ๐ก ํด๊ฒฐ๋ฐฉ๋ฒ mapper์ useGenerateKeys = "true" ์ต์ ์ด ๋ค์ด๊ฐ ์์๋๋ฐ ํด๋น ๋ถ๋ถ์ ์ญ์ ํ๋ ์๋ฌ ์์ด ํ ์คํธ๊ฐ ์ ์ ์ฒ๋ฆฌ ๋์๋ค.
-
๐ป ์๋ฐ ์๊ณ ๋ฆฌ์ฆ - ์ด์ด ๋ถ์ธ ์algorithm 2023. 9. 18. 11:17
๐ ๋ฌธ์ ์ค๋ช ์ ์๊ฐ ๋ด๊ธด ๋ฆฌ์คํธ num_list๊ฐ ์ฃผ์ด์ง๋๋ค. num_list์ ํ์๋ง ์์๋๋ก ์ด์ด ๋ถ์ธ ์์ ์ง์๋ง ์์๋๋ก ์ด์ด ๋ถ์ธ ์์ ํฉ์ returnํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. ๐ ์ ํ ์ฌํญ 2 ≤ num_list์ ๊ธธ์ด ≤ 10 1 ≤ num_list์ ์์ ≤ 9 num_list์๋ ์ ์ด๋ ํ ๊ฐ์ฉ์ ์ง์์ ํ์๊ฐ ์์ต๋๋ค. ๐ ๋ต์ class Solution { public int solution(int[] num_list) { int answer = 0; String even = ""; String odd = ""; for(int i=0; i
-
๐ป ์๋ฐ ์๊ณ ๋ฆฌ์ฆ - ์์๋ค์ ๊ณฑ๊ณผ ํฉalgorithm 2023. 9. 18. 11:03
๐ ๋ฌธ์ ์ค๋ช ์ ์๊ฐ ๋ด๊ธด ๋ฆฌ์คํธ num_list๊ฐ ์ฃผ์ด์ง ๋, ๋ชจ๋ ์์๋ค์ ๊ณฑ์ด ๋ชจ๋ ์์๋ค์ ํฉ์ ์ ๊ณฑ๋ณด๋ค ์์ผ๋ฉด 1์ ํฌ๋ฉด 0์ returnํ๋๋ก solution ํจ์๋ฅผ ์์ฑํด์ฃผ์ธ์. ๐ ์ ํ ์ฌํญ 2 ≤ num_list์ ๊ธธ์ด ≤ 10 1 ≤ num_list์ ์์ ≤ 9 ๐ ๋ต์ class Solution { public int solution(int[] num_list) { int answer = 0; int mul = num_list[0]; int square = num_list[0]; for(int i=1; i(square*square)? 0:1; } } for๋ฌธ์ ๋๋ฉด์ ์์ฐจ์ ์ผ๋ก ๊ฐ๊ฐ์ ๋ณ์์ ๊ณฑํ๊ฑฐ๋ ๋ํ๋ฉด์ ์์์ ๊ฐ์ ๋ด๋๋ค. ๊ทธ๋ฆฌ๊ณ for๋ฌธ์ ๋น ์ ธ๋์ ๋ฆฌํดํ๊ธฐ์ ์ผํญ ์ฐ์ฐ์๋ฅผ ..
-
๐ป ์๋ฐ ์๊ณ ๋ฆฌ์ฆ - ์ฝ๋ ์ฒ๋ฆฌํ๊ธฐalgorithm 2023. 9. 18. 10:50
๐ ๋ฌธ์ ์ค๋ช ๋ฌธ์์ด code๊ฐ ์ฃผ์ด์ง๋๋ค. code๋ฅผ ์์์๋ถํฐ ์ฝ์ผ๋ฉด์ ๋ง์ฝ ๋ฌธ์๊ฐ "1"์ด๋ฉด mode๋ฅผ ๋ฐ๊ฟ๋๋ค. mode์ ๋ฐ๋ผ code๋ฅผ ์ฝ์ด๊ฐ๋ฉด์ ๋ฌธ์์ด ret์ ๋ง๋ค์ด๋ ๋๋ค. mode๋ 0๊ณผ 1์ด ์์ผ๋ฉฐ, idx๋ฅผ 0 ๋ถํฐ code์ ๊ธธ์ด - 1 ๊น์ง 1์ฉ ํค์๋๊ฐ๋ฉด์ code[idx]์ ๊ฐ์ ๋ฐ๋ผ ๋ค์๊ณผ ๊ฐ์ด ํ๋ํฉ๋๋ค. mode๊ฐ 0์ผ ๋ code[idx]๊ฐ "1"์ด ์๋๋ฉด idx๊ฐ ์ง์์ผ ๋๋ง ret์ ๋งจ ๋ค์ code[idx]๋ฅผ ์ถ๊ฐํฉ๋๋ค. code[idx]๊ฐ "1"์ด๋ฉด mode๋ฅผ 0์์ 1๋ก ๋ฐ๊ฟ๋๋ค. mode๊ฐ 1์ผ ๋ code[idx]๊ฐ "1"์ด ์๋๋ฉด idx๊ฐ ํ์์ผ ๋๋ง ret์ ๋งจ ๋ค์ code[idx]๋ฅผ ์ถ๊ฐํฉ๋๋ค. code[idx]๊ฐ "1"์ด๋ฉด mode๋ฅผ 1์์ 0์ผ๋ก ..
-
๐ javascript - async awaitjavascript 2023. 9. 15. 15:14
๐ async ์ await javascript์ ๋น๋๊ธฐ ์ฒ๋ฆฌ ํจํด์ค ์ ์ผ ์ต๊ทผ์ ๋ฌธ๋ฒ์ผ๋ก ๊ธฐ์กด์ ๋น๋๊ธฐ ์ฒ๋ฆฌ ๋ฐฉ์์ธ ์ฝ๋ฐฑ ํจ์์ ํ๋ก๋ฏธ์ค์ ๋จ์ ์ ๋ณด์ํ๊ณ ๊ฐ๋ ์ฑ ๋์ ์ฝ๋๋ฅผ ์ง์ ๐ async & await ๊ธฐ๋ณธ ๋ฌธ๋ฒ async function ํจ์๋ช () { await ๋น๋๊ธฐ์ฒ๋ฆฌ ๋ฉ์๋๋ช (); } ํจ์์ ๋ด๋ถ ๋ก์ง์ค HTTP ํต์ ์ ํ๋ ๋น๋๊ธฐ ์ฒ๋ฆฌ ์ฝ๋ ์์ await๋ฅผ ๋ถ์ธ๋ค. ์ฌ๊ธฐ์ ์ฃผ์ํด์ผ ํ ์ ์ ๋น๋๊ธฐ ์ฒ๋ฆฌ ๋ฉ์๋๊ฐ ๊ผญ ํ๋ก๋ฏธ์ค ๊ฐ์ฒด๋ฅผ ๋ฐํํด์ผ await๊ฐ ์ ์ ๋์ํ๋ค. ๐ example function mainExcel() { return new Promise(function(resolve, reject){ $.ajax({ url: '/', type: "GET", data: postda..