์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |
- spring data jpa
- ๋ถํธ์บ ํ
- ๋ฐ์ผ๋ฆฌ์ฝ๋ฉ
- Publishing
- fibonacci
- ์๋ฐ
- ์๊ณ ๋ฆฌ์ฆ
- ์ ๋ค๋ฆญ์ค
- ๊ณ์ฐ๊ธฐ๋ง๋ค๊ธฐ
- ๋ฐฑ์ค์๊ณ ๋ฆฌ์ฆ
- ์๋ฃ๊ตฌ์กฐ
- FilterChain
- ์ธํ ๋ฆฌ์ ์ด
- ๊ทธ๋ฆฌ๋
- ๊นํ๋ธ
- Spring Security
- ์ฒซ๊ธ์๋๋ฌธ์
- ํ์ดํ๋ก๊ทธ๋๋ฐ
- ์คํ๋ง
- Spring Data JDBC
- HTML
- ๊ฑฐ๋ญ์ ๊ณฑ
- ๋ฐฑ์๋
- ๋ฌธ์์ด๋ค์ง๊ธฐ
- java
- CSS
- CLI๋ช ๋ น์ด
- ์ปฌ๋ ์ ํ๋ ์์ํฌ
- testing
- ํ๊ณ
- Today
- Total
๋ชฉ๋ก์๋ฐ (18)
๋์ ๋ชจ์
โ๏ธ Description Return power input two numbers input base: int (base >= 2) exponent: int (exponent >= 0) output return long return rest of divided by 94,906,249 of the actual calculation results caution Avoid using Math.pow, power operators Time Complexity O(logN) example of in/output ong output = power(3, 40); System.out.println(output); // --> 19334827 ๐ TIL Power: Multiply the same number mult..

๐Checked Exception ์์ธ๋ฅผ ์ก์์(catch) ์ฒดํฌํ ํ ๋ฐ๋์ ์๋ฌ์ฒ๋ฆฌ(try~catch)๋ฅผ ํด์ผํ๋ ์์ธ์ด๋ค. Exception ํด๋์ค์ ํ์ ํด๋์ค (Exception ์์๋ฐ์) ClassNotFoundException, FileNotFoundException, SQLException, … ๐Unchecked Exception ์์ธ๋ฅผ ์ก์์(catch) ํด๋น ์์ธ์ ๋ํ ์ฒ๋ฆฌ(try~catch)๋ฅผ ํ ํ์๊ฐ ์๋ ์์ธ์ด๋ค. RuntimeException์ ํ์ ํด๋์ค (RuntimeException ์์๋ฐ์) ์ฃผ๋ก ๊ฐ๋ฐ์๊ฐ ์ฝ๋๋ฅผ ์๋ชป ์์ฑํด์ ๋ฐ์ํ๋ ์ค๋ฅ๋ค์ ๋ชจ๋ RuntimeException์ ์์ํ ์์ธ๋ค์ด๋ค. NullPointException, ArrayIndexOutOfBo..
โ๏ธ Description Return whether the sample is a subset of the base by receiving two arrays input base: temporary Array with element of int sample: temporary Array with element of int output: boolean caution: no duplicates example of in/output int[] base = new int[]{1, 2, 3, 4, 5}; int[] sample = new int[]{1, 3}; boolean output = isSubsetOf(base, sample); System.out.println(output); // --> true sam..
๐ @ExceptionHandler๋ฅผ ์ด์ฉํ ์์ธ ์ฒ๋ฆฌ Controller ํด๋์ค ๋ ๋ฒจ์์ @ExceptionHandler๋ฅผ ์ฌ์ฉํ๋ฉด ํด๋น Controller์์ ๋ฐ์ํ๋ ์์ธ๋ฅผ ์ฒ๋ฆฌํ ์ ์๋ค. ํ์ํ ์์ธ ์ ๋ณด๋ง ๋ด์ ์ ์๋ Error ์ ์ฉ Response ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํ๋ฉด ํด๋ผ์ด์ธํธ์๊ฒ ์กฐ๊ธ ๋ ์น์ ํ ์๋ฌ ์ ๋ณด๋ฅผ ์ ๊ณตํ ์ ์๋ค. BUT! @ExceptionHandler ๋ฐฉ์์ Controller๋ง๋ค ๋์ผํ๊ฒ ๋ฐ์ํ๋ ์์ธ ์ฒ๋ฆฌ์ ๋ํ ์ค๋ณต ์ฝ๋๊ฐ ๋ฐ์ํ ์ ์๊ธฐ ๋๋ฌธ์ ๋ค์ํ ์ ํ์ ์์ธ๋ฅผ ์ฒ๋ฆฌํ๊ธฐ์๋ ์ ์ ํ์ง ์๋ค. โ Ref. @ExceptionHandler https://docs.spring.io/spring-framework/docs/current/reference/html/web.htm..

โ๏ธ Description ์ ์๋ฅผ ์์๋ก ๊ฐ๋ ๋ฐฐ์ด์ ์ ๋ ฅ๋ฐ์ 3๊ฐ์ ์์๋ฅผ ๊ณฑํด ๋์ฌ ์ ์๋ ์ต๋๊ฐ ๋ฆฌํด ์ ๋ ฅ: int[] ํ์ ์ ์์๋ก ๊ฐ๋ ์์์ ๋ฐฐ์ด ์ถ๋ ฅ: int ์ฃผ์์ฌํญ ์ฃผ์ด์ง ๋ฐฐ์ด์ ์ค์ฒฉ๋์ง ์์ 1์ฐจ์ ๋ฐฐ์ด ๋ฐฐ์ด ์์๋ ์์์ 0์ ํฌํจํ๋ ์ ์ ๋ฐฐ์ด ๊ธธ์ด๋ 3 ์ด์ ์ ์ถ๋ ฅ ์์ int output = largestProductOfThree(new int[]{2, 1, 3, 7}); // --> 42 (= 2 * 3 * 7) output = largestProductOfThree(new int[]{-1, 2, -5, 7}); // --> 35 (= -1 * -5 * 7) ๐ Flow - ๊ฐ์ฅ ํฐ ์๋ฅผ ๊ณฑํ๊ธฐ => ์ค๋ฆ์ฐจ์ ์ ๋ ฌํด์ ๋งจ ๋ค์ ์ธ ๊ฐ ๊ณฑํด์ค - ๋ฐฐ์ด์ ์์ ์์ ๋ => ํฐ ..
โ๏ธ Description ์๋ฅผ ์ ๋ ฅ๋ฐ์ ์ ๊ณฑ๊ทผ ๊ฐ์ ์์์ ๋ ์๋ฆฌ๊น์ง ๋ฆฌํด ์ ๋ ฅ: int ํ์ ์ ์ ์ (num >= 2) ์ถ๋ ฅ: String ์ต๋ ์์์ ๋์งธ ์ง๋ฆฌ๊น์ง ๊ตฌํ ์๋ฅผ ๋ฌธ์์ด๋ก ๋ณํํ์ฌ ์ถ๋ ฅํฉ๋๋ค. (์์์ ์ ์งธ ์๋ฆฌ์์ ๋ฐ์ฌ๋ฆผ) ์ ์ถ๋ ฅ ์์ String output = computeSquareRoot(9); // --> "3.00" output = computeSquareRoot(6); // --> "2.45" ํํธ ์์์ ์ฒ๋ฆฌ๋ java ํ์ค ๋ด์ฅ ๊ฐ์ฒด์ธ String๋ฅผ ์ฌ์ฉ (java decimal places limit ๋๋ ์๋ฐ ์์์ ์๋ฆฌ์) ๋ฐ๋น๋ก๋์ ๋ฒ์ ์ ํ์(recurrence formula) https://ko.wikipedia.org/wiki/๋ฐ๋น๋ก๋์_๋ฒ ๐ Flow ..
โ๏ธ Description ๋ฌธ์์ด์ ์ ๋ ฅ๋ฐ์ ์์ด์๊ทธ๋จ์ธ์ง ์ฌ๋ถ๋ฅผ ๋ฆฌํด ์ ๋ ฅ: String ์ถ๋ ฅ: boolean ์ ์ถ๋ ฅ ์์ boolean output = isIsogram("aba"); // false output = isIsogram("Dermatoglyphics"); // true output = isIsogram("moOse"); // false ๐ Flow - ์ ๋ ฅ๋ฐ์ ๋ฌธ์์ด์ ํ๋์ฉ ์๋ผ์ => split() - ๋ฌธ์์ด ๋ฐฐ์ด์ ๋ด์์ ์ํ => forEach - ๊ฐ์ ๋ฌธ์๊ฐ ์๋์ง ์๋ค๋ก ์ฝ์ด์ค๋ฉด์ ๋น๊ต => indexOf, lastIndexOf - ๋ฌธ์ ๋น๊ตํด์ ๊ฐ์๊ฒ ์์ผ๋ฉด false ๋ฆฌํด ๐คฏ Trouble ๋์๋ฌธ์๋ ๊ตฌ๋ณํ์ง ์๋๋ค๊ณ ํด์ a == A ๋ก ์๊ฐํ๋ค. ⇒ ๊ฐ์ด ์๋์ด a ≠..
๐ ๋ฐ์ผ๋ฆฌ ์ฝ๋ฉ ๐ค computeWhenDouble ํ ์คํธ ์คํํ๋๋ฐ ์คํ์๊ฐ์ด๊ณผ๊ฐ ๋์ค๊ณ ์ ์ถ๋ ๋์ง ์์๋ค. ์ ์ ๋ฐ ๋ฉ์์ง๊ฐ ๋์ค๋์ง ๊ถ๊ธํด์ ์ง๋ฌธํ์ง๋ง ํด๊ฒฐ์ ๋์ง ์์๋ค! ๐ง ๋ฌดํ๋ฃจํ ๋๋ฌธ์ ๊ทธ๋ฐ๊ฐ ํ๋๋ฐ double๋ก ์จ์ผํ๋ ๊ฒ์ int๋ก ์จ์ ๊ทธ๋ฌ๋ค. ํด๊ฒฐ์๋ฃ ๐ JSON(JavaScript Object Notation) ๋ฐ์ดํฐ ๊ตํ์ ์ํด ๋ง๋ค์ด์ง ๊ฐ์ฒด ํํ์ ํฌ๋งท ๐ค ์ ์ก ๊ฐ๋ฅ ์กฐ๊ฑด ์์ ์์ ๋ฐ์ ์๊ฐ ๊ฐ์ ํ๋ก๊ทธ๋จ์ ์ฌ์ฉํ ๋ ๋ฌธ์์ด์ฒ๋ผ ๋ฒ์ฉ์ ์ผ๋ก ์ฝ์ ์ ์๋ ํํ์ผ ๋ ๐ค JSON ํน์ง ์ด๋ฆ-๊ฐ ์ ๊ฐ์ ์์๊ฐ ์ง์ ๋ ๋ชฉ๋ก ํ๋ก๊ทธ๋๋ฐ ์ธ์ด์ ํธํ ๊ฐ๋ฅํ ๋ฐ์ดํฐ๊ตฌ์กฐ ๐ค JSON ํ์ ์ด๋ฆ-๊ฐ ์์ ์์์๋ ์งํฉ ๊ฐ์ฒด ์์๊ณผ ๋: { } ์ด๋ฆ ๋ค: ์ฝ๋ก (:) ๋ถ์ ์ด๋ฆ-๊ฐ ์ ๊ตฌ๋ถ: ์ฝค..