์๋ฃ๊ตฌ์กฐ (data structures) ์ด๋? # max๋ฅผ ์คํํ๋๋ฐ ๊ฑธ๋ฆฌ๋ ์๊ฐ ์์๋ณด๊ธฐ import time n = int(input("Number of elements: ")) haystack = [k for k in range(n)] print("Searching for the maximum value...") ts = time.time() maximum = max(haystack) elapsed = time.time() - ts print("Maximum element = %d, Elapsed time = %.2f" %(maximum, elapsed)) ์๊ณ ๋ฆฌ์ฆ (algorithm) ์ด๋? ์ฌ์ ์ ์ ์ - ์ด๋ค ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํ ์ ์ฐจ, ๋ฐฉ๋ฒ, ๋ช ๋ น์ด๋ค์ ์งํฉ ํ๋ก๊ทธ๋๋ฐ - ์ฃผ์ด์ง ๋ฌธ์ ์ ํด..

๋ฌธ์ ์ค๋ช ์์ฐ์ n์ ์ ๋ ฅ๋ฐ์ n์ ์ฝ์๋ฅผ ๋ชจ๋ ๋ํ ๊ฐ์ ๋ฆฌํดํ๋ ํจ์, solution์ ์์ฑํด์ฃผ์ธ์. ์ ํ ์ฌํญ n์ 0 ์ด์ 3000์ดํ์ธ ์์ฐ์์ ๋๋ค. ์ ์ถ๋ ฅ ์ n return 12 28 5 6 ์ ์ถ๋ ฅ ์ ์ค๋ช ์ ์ถ๋ ฅ ์ #1 12์ ์ฝ์๋ 1, 2, 3, 4, 6, 12์ ๋๋ค. ์ด๋ฅผ ๋ชจ๋ ๋ํ๋ฉด 28์ ๋๋ค. ์ ์ถ๋ ฅ ์ #2 5์ ์ฝ์๋ 1, 5์ ๋๋ค. ์ด๋ฅผ ๋ชจ๋ ๋ํ๋ฉด 6์ ๋๋ค. ํ์ด class Solution { public int solution(int n) { int answer = 0; for(int i = 1; i

๋ฌธ์ ์ค๋ช ๋จ์ด s์ ๊ฐ์ด๋ฐ ๊ธ์๋ฅผ ๋ฐํํ๋ ํจ์, solution์ ๋ง๋ค์ด ๋ณด์ธ์. ๋จ์ด์ ๊ธธ์ด๊ฐ ์ง์๋ผ๋ฉด ๊ฐ์ด๋ฐ ๋๊ธ์๋ฅผ ๋ฐํํ๋ฉด ๋ฉ๋๋ค. ์ฌํ์ฌํญ s๋ ๊ธธ์ด๊ฐ 1 ์ด์, 100์ดํ์ธ ์คํธ๋ง์ ๋๋ค. ์ ์ถ๋ ฅ ์ s return abcde c qwer we ํ์ด class Solution { public String solution(String s) { String answer = ""; int index; int sLength = s.length(); if(sLength%2 == 0) { //์ง์์ผ ๊ฒฝ์ฐ index = sLength/2-1; answer = Character.toString(s.charAt(index)) + Character.toString(s.charAt(index+1)); } els..

๋ฌธ์ ์ค๋ช ๋ ์๋ฅผ ์ ๋ ฅ๋ฐ์ ๋ ์์ ์ต๋๊ณต์ฝ์์ ์ต์๊ณต๋ฐฐ์๋ฅผ ๋ฐํํ๋ ํจ์, solution์ ์์ฑํด ๋ณด์ธ์. ๋ฐฐ์ด์ ๋งจ ์์ ์ต๋๊ณต์ฝ์, ๊ทธ๋ค์ ์ต์๊ณต๋ฐฐ์๋ฅผ ๋ฃ์ด ๋ฐํํ๋ฉด ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด ๋ ์ 3, 12์ ์ต๋๊ณต์ฝ์๋ 3, ์ต์๊ณต๋ฐฐ์๋ 12์ด๋ฏ๋ก solution(3, 12)๋ [3, 12]๋ฅผ ๋ฐํํด์ผ ํฉ๋๋ค. ์ ํ ์ฌํญ ๋ ์๋ 1์ด์ 1000000์ดํ์ ์์ฐ์์ ๋๋ค. ์ ์ถ๋ ฅ ์ n m return 3 12 [3, 12] 2 5 [1, 10] ์ ์ถ๋ ฅ ์ ์ค๋ช ์ ์ถ๋ ฅ ์ #1 ์์ ์ค๋ช ๊ณผ ๊ฐ์ต๋๋ค. ์ ์ถ๋ ฅ ์ #2 ์์ฐ์ 2์ 5์ ์ต๋๊ณต์ฝ์๋ 1, ์ต์๊ณต๋ฐฐ์๋ 10์ด๋ฏ๋ก [1, 10]์ ๋ฆฌํดํด์ผ ํฉ๋๋ค. ํ์ด class Solution { public int[] solution(int n, in..

๋ฌธ์ ์ค๋ช ๋ฌธ์์ด s๋ ํ ๊ฐ ์ด์์ ๋จ์ด๋ก ๊ตฌ์ฑ๋์ด ์์ต๋๋ค. ๊ฐ ๋จ์ด๋ ํ๋ ์ด์์ ๊ณต๋ฐฑ๋ฌธ์๋ก ๊ตฌ๋ถ๋์ด ์์ต๋๋ค. ๊ฐ ๋จ์ด์ ์ง์๋ฒ์งธ ์ํ๋ฒณ์ ๋๋ฌธ์๋ก, ํ์๋ฒ์งธ ์ํ๋ฒณ์ ์๋ฌธ์๋ก ๋ฐ๊พผ ๋ฌธ์์ด์ ๋ฆฌํดํ๋ ํจ์, solution์ ์์ฑํ์ธ์. ์ ํ ์ฌํญ ๋ฌธ์์ด ์ ์ฒด์ ์ง/ํ์ ์ธ๋ฑ์ค๊ฐ ์๋๋ผ, ๋จ์ด(๊ณต๋ฐฑ์ ๊ธฐ์ค)๋ณ๋ก ์ง/ํ์ ์ธ๋ฑ์ค๋ฅผ ํ๋จํด์ผํฉ๋๋ค. ์ฒซ ๋ฒ์งธ ๊ธ์๋ 0๋ฒ์งธ ์ธ๋ฑ์ค๋ก ๋ณด์ ์ง์๋ฒ์งธ ์ํ๋ฒณ์ผ๋ก ์ฒ๋ฆฌํด์ผ ํฉ๋๋ค. ์ ์ถ๋ ฅ ์ s retrun try hello world TrY HeLlO WoRlD ์ ์ถ๋ ฅ ์ ์ค๋ช try hello world๋ ์ธ ๋จ์ด try, hello, world๋ก ๊ตฌ์ฑ๋์ด ์์ต๋๋ค. ๊ฐ ๋จ์ด์ ์ง์๋ฒ์งธ ๋ฌธ์๋ฅผ ๋๋ฌธ์๋ก, ํ์๋ฒ์งธ ๋ฌธ์๋ฅผ ์๋ฌธ์๋ก ๋ฐ๊พธ๋ฉด TrY, HeLlO,..
- Total
- Today
- Yesterday
- ์๊ณ ๋ฆฌ์ฆ
- ๊ฒ์ํ๋ง๋ค๊ธฐ
- ์ดํด๋ฆฝ์ค ์ค์น
- Java
- ๊ฒ์ํ ์กฐํ
- typeAliases
- ์๋ฃ๊ตฌ์กฐ
- ๊ฒ์๋ฌผ ์ญ์
- java ํ๊ฒฝ๋ณ์
- ๊ฐ๋ฐํ๊ฒฝ๊ตฌ์ถ
- java jdk ์ค์น
- ์จ๋ฆฌ์์ค
- ์ ์ฒด๊ฒ์๋ฌผ ์กฐํ
- ๊ฐ๋ฐ
- tomcat์ค์น
- Algorithm
- ์ดํด๋ฆฝ์ค ํ๊ธ ์ธ์ฝ๋ฉ
- ๋ณ๋ช ์ฒ๋ฆฌ
- ๊ฒ์ํ ์ญ์
- ์๋ฐ
- mysql์ค์น
- ๋ถํธ ์๋์์ฑ
- ๊ฒ์๋ฌผ์กฐํ
- ์คํ๋ง๋ถํธ ์๋์์ฑ
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |