728x90
๋ฐ˜์‘ํ˜•
 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

์•Œ๊ณ ๋ฆฌ์ฆ˜/์ •๋ ฌ

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์„ ํƒ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ (Selection sort in Javascript)

์„ ํƒ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ๊ณต๋ถ€ํ•˜๋‹ค๋ณด๋ฉด ๋ฒ„๋ธ”์ •๋ ฌ๋งŒํผ ์ต์ˆ™ํ•˜๊ฒŒ ๋“ค์–ด๋ณธ ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ค‘ ํ•˜๋‚˜์ผ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋ฒ„๋ธ”์ •๋ ฌ ๋งŒํผ ๊ตฌํ˜„ํ•˜๊ธฐ ์‰ฝ๊ณ , ๊ธฐ์—… ์ฝ”๋”ฉํ…Œ์ŠคํŠธ๋ฅผ ํ•˜๋‹ค๋ณด๋ฉด ํ•œ๋ฒˆ์”ฉ ๋ฌธ์ œ๋กœ ๋‚˜์˜ค๊ณค ํ•˜๋Š” ์„ ํƒ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜! ์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” ์„ ํƒ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ํŠน์ง•๊ณผ ๊ตฌํ˜„ ์˜ˆ์‹œ์— ๋Œ€ํ•ด์„œ ์†Œ๊ฐœํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์„ ํƒ ์ •๋ ฌ์ด๋ž€? ์„ ํƒ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ์ปจ์…‰์€ ์š”์†Œ๋“ค์ด ๋“ค์–ด๊ฐˆ ์œ„์น˜๋Š” ์ด๋ฏธ ์ •ํ•ด์ ธ์žˆ๋‹ค๋Š” ๊ฒƒ์— ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, ๋ฐฐ์—ด์˜ ์ฒซ ๋ฒˆ์งธ ์ž๋ฆฌ์—๋Š” ๋ฐฐ์—ด ์š”์†Œ๋“ค ์ค‘ ๊ฐ€์žฅ ์ž‘์€ ์š”์†Œ๊ฐ€ ๋“ค์–ด๊ฐ€๋ฉด ๋˜๊ฒ ์ฃ ? ๊ทธ๋ฆฌ๊ณ  ๋‘ ๋ฒˆ์งธ ์ž๋ฆฌ์—๋Š” ๊ทธ ๋‹ค์Œ ๊ฐ€์žฅ ์ž‘์€ ์š”์†Œ๋ฅผ ์„ ํƒํ•ด์„œ ๊ทธ ์ž๋ฆฌ์— ๋„ฃ์œผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ๋ฐฐ์—ด์ด ๋๋‚  ๋•Œ๊นŒ์ง€ ์ด ๋‹จ๊ณ„๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์„ ํƒ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์˜ˆ์‹œ ์„ ํƒ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์ข€ ๋” ์‰ฝ๊ฒŒ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด ์ฝ”๋“œ๋ฅผ..

2020.11.19 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

์•Œ๊ณ ๋ฆฌ์ฆ˜/์ •๋ ฌ

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ๋ฒ„๋ธ”์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ (Bubble sort in Javascript)

'๋ฒ„๋ธ”์ •๋ ฌ' ์•Œ๊ณ ๋ฆฌ์ฆ˜์€ ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ๋ฅผ ์ค€๋น„ํ•  ๋•Œ ๊ฐ€์žฅ ์ฒ˜์Œ ์ ‘ํ•˜๋Š” ์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค. ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ์—๋„ ํ•œ๋ฒˆ์”ฉ ๋“ฑ์žฅํ•˜๋Š” '๋ฒ„๋ธ”์ •๋ ฌ' ์•Œ๊ณ ๋ฆฌ์ฆ˜์— ๋Œ€ํ•ด์„œ ์˜ค๋Š˜ ํ™•์‹คํ•˜๊ฒŒ ๊ฐœ๋…์„ ์žก๊ณ  ์ดํ•ดํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ตฌํ˜„ ์˜ˆ์‹œ์˜ ์–ธ์–ด๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„๋˜์—ˆ์œผ๋‚˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ๊ธฐ๋ณธ ์ปจ์…‰์€ ๋™์ผํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ด์™ธ์— ๋‹ค๋ฅธ ์–ธ์–ด๋กœ ๊ตฌํ˜„ํ•˜์…”๋„ ๋ฌด๋ฐฉํ•ฉ๋‹ˆ๋‹ค. ๋ฒ„๋ธ” ์ •๋ ฌ์ด๋ž€? ๊ฑฐํ’ˆ ์ •๋ ฌ์ด๋ผ๊ณ ๋„ ๋ถˆ๋ฆฌ๋Š” ๋ฒ„๋ธ” ์ •๋ ฌ์€ ๋‘ ์ธ์ ‘ํ•œ ์›์†Œ๋ฅผ ๊ฒ€์‚ฌํ•˜์—ฌ ์ •๋ ฌ(์˜ค๋ฆ„์ฐจ์ˆœ, ๋‚ด๋ฆผ์ฐจ์ˆœ)ํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. (์˜ค๋ฆ„์ฐจ์ˆœ์ด๋ผ๋ฉด ์ž‘์€ ๊ฐ’๋ถ€ํ„ฐ ํฐ ๊ฐ’ ์ˆœ์œผ๋กœ ์ •๋ ฌ์ด ๋  ๊ฒƒ์ด๊ณ , ๋‚ด๋ฆผ์ฐจ์ˆœ์ด๋ผ๋ฉด ํฐ ๊ฐ’๋ถ€ํ„ฐ ์ž‘์€ ๊ฐ’ ์ˆœ์œผ๋กœ ์ •๋ ฌ์ด ๋˜๊ฒ ์ฃ ?) ๋ฒ„๋ธ”์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์˜ˆ์‹œ ๋ฒ„๋ธ”์ •๋ ฌ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์ข€ ๋” ์‰ฝ๊ฒŒ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด ์ฝ”๋“œ๋ฅผ ๋ณด๊ธฐ ์ „์— ํ•ด๋‹น ์ž๋ฃŒ๋ฅผ ํ•œ๋ฒˆ ๋ณด์‹œ๋ฉด ์ข€..

2020.11.16 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜์—ด ๊ตฌํ˜„ (fibonacci in javascript)

ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜์—ด์ด๋ž€? 0ํ•ญ์„ 0, 1ํ•ญ์„ 1๋กœ ๋‘๊ณ , ๋‘๋ฒˆ ์งธ ํ•ญ๋ถ€ํ„ฐ๋Š” ๋ฐ”๋กœ ์•ž์˜ ๋‘ ์ˆ˜๋ฅผ ๋”ํ•œ ์ˆ˜๋กœ ๋†“๋Š” ๊ฒƒ์ด ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜์—ด์ด๋‹ค. ์•„๋ž˜์™€ ๊ฐ™์€ ์ ํ™”์‹์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค. F0 = 0; F1 = 1; Fn+2 = Fn+1 + Fn;์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ ์ž„์˜์˜ ์ˆซ์ž๋ฅผ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ๋ฐ›์•„์„œ ๊ทธ ์ˆซ์ž๋งŒํผ ํ”ผ๋ณด๋‚˜์น˜ ์ˆ˜์—ด์˜ ๊ฐ’์„ ๋‚˜์—ดํ•˜๋Š” ๋กœ์ง์„ ๊ตฌํ˜„ํ•ด๋ณด์ž. // ํ”ผ๋ณด๋‚˜์น˜ ๊ตฌํ˜„ ํ•จ์ˆ˜ export function getFibonacci(num) { let i = 0; let value1 = 0; let value2 = 1; let result = []; while (i < num) { let newValue = value1 + value2; result.push(newValue); value1 = value2; value2 =..

2020.06.25 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ์†Œ์ˆ˜ ๊ตฌํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ตฌํ˜„(prime number in javascript)

์†Œ์ˆ˜๋ž€? 1๊ณผ ์ž์‹ ์„ ์ œ์™ธํ•œ ์–ด๋– ํ•œ ์ •์ˆ˜๋กœ๋„ ๋‚˜๋ˆ„์–ด์ง€์ง€ ์•Š๋Š” ์ˆ˜๊ฐ€ ์†Œ์ˆ˜์ด๋‹ค. 1 ~ 1000 ์‚ฌ์ด์˜ ์ˆซ์ž ์ค‘์— ์†Œ์ˆ˜๋งŒ์„ ๊ตฌํ•˜๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ๊ตฌํ˜„ํ•ด๋ณด์ž. ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ function getPrimeNumber() { let results = []; // 1๊ณผ 1000์‚ฌ์ด์˜ ์ˆซ์ž ์ค‘์— ์†Œ์ˆ˜๋ฅผ ๊ตฌํ•˜๊ธฐ ์œ„ํ•œ ๋ฐ˜๋ณต๋ฌธ for (let i = 1; i

2020.02.11 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[LeetCode] 204. Count Primes

Count the number of prime numbers less than a non-negative number, n. Example: Input: 10 Output: 4 Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7. ํ•ด๋‹น ๋ฌธ์ œ๋ฅผ ํ’€ ๋•Œ, ์ฒ˜์Œ์—๋Š” ๋‹จ์ˆœํ•˜๊ฒŒ ์ ‘๊ทผํ•˜์—ฌ ์ด์ค‘ for๋ฌธ์œผ๋กœ ๊ตฌํ˜„ํ•˜๋ ค๊ณ  ํ•˜์˜€์œผ๋‚˜ Time Limit Exceeded ์ œ์•ฝ์— ๊ฑธ๋ ค๋ฒ„๋ ค ํ†ต๊ณผ๋ฅผ ํ•  ์ˆ˜ ์—†๋Š” ์ƒํ™ฉ์ด ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ๋ฌธ์ œ๋ฅผ ๊ณ ๋ฏผํ•˜๋‹ค๊ฐ€ ๋ถ„๋ช… ์‹œ๊ฐ„๋ณต์žก๋„๋ฅผ ์ค„์ด๊ธฐ ์œ„ํ•œ ์ข‹์€ ์•„์ด๋””์–ด๊ฐ€ ์กด์žฌํ• ๊ฑฐ๋ผ ์ƒ๊ฐํ•˜์—ฌ ๋ฆฌ์„œ์น˜ํ•œ ๊ฒฐ๊ณผ ์—๋ผํ† ์Šคํ…Œ๋„ค์Šค์˜ ์ฒด๋ผ๋Š” ์†Œ์ˆ˜ ํŒ๋ณ„ ๋ฐฉ๋ฒ•์ด ์กด์žฌํ•˜๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ ‘๊ทผ ๋ฐฉ๋ฒ•์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค. 2๋ถ€ํ„ฐ ์†Œ์ˆ˜๋ฅผ ๊ตฌ..

2019.08.07 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Sum of the first nth term of Series

Description: Task: Your task is to write a function which returns the sum of following series upto nth term(parameter). Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +... Rules:ยท You need to round the answer upto 2 decimal places and return it as String.ยท If the given value is 0 then it should return 0.00ยท You will only be given Natural Numbers as arguments. Examples: SeriesSum(1) => 1 = "1" Series..

2016.10.19 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Two to One

Description:Take 2 strings s1 and s2 including only letters from ato z. Return a new sorted string, the longest possible, containing distinct letters, - each taken only once - coming from s1 or s2.Examples:a = "xyaabbbccccdefww"b = "xxxxyyyyabklmopq"longest(a, b) -> "abcdefklmopqwxy" a = "abcdefghijklmnopqrstuvwxyz"longest(a, a) -> "abcdefghijklmnopqrstuvwxyz" ํ•„์ž๋‹ต์•ˆ ์ฒ˜์Œ์— split() ๋ฉ”์†Œ๋“œ๋ฅผ ํ™œ์šฉํ•ด์„œ ๋ฌธ์ž์—ด ๋ฐ์ดํ„ฐํƒ€..

2016.10.19 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Sum of two lowest positive integers

Description: Create a function that returns the sum of the two lowest positive numbers given an array of minimum 4 integers. No floats or empty arrays will be passed. For example, when an array is passed like [19,5,42,2,77], the output should be 7. [10,343445353,3453445,3453545353453] should return 3453455. Hint: Do not modify the original array. ์ „๊ณผ ๋น„์Šทํ•œ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. ์ด๋ฒˆ ๋ฌธ์ œ๋Š” ๋ฐฐ์—ด์—์„œ ๊ฐ€์žฅ ๋‚ฎ์€ ์ˆซ์ž 2๊ฐœ๋ฅผ ๊ตฌํ•ด์„œ ๊ทธ ์ˆซ์ž 2..

2016.10.16 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Largest Elements

Write a program that outputs the top n elements from a list. Example: largest(2, [7,6,5,4,3,2,1]) // => [6,7] ๋ฐฐ์—ด์˜ ์ •๋ ฌ ๋ฉ”์†Œ๋“œ์™€ slice() ๋ฉ”์†Œ๋“œ๋ฅผ ํ™œ์šฉํ•ด์„œ ๋ฐฐ์—ด์—์„œ ์ œ์ผ ํฐ ๊ฐ’ n๊ฐœ๋ฅผ ๋ฝ‘์•„๋‚ด๋Š” ์•Œ๊ณ ๋ฆฌ์ฆ˜์ž…๋‹ˆ๋‹ค.์ •๋ ฌ๋ฉ”์†Œ๋“œ๋Š” ๋ฌธ์ž์—ด ๊ธฐ์ค€์œผ๋กœ ๋™์ž‘ํ•˜๋ฏ€๋กœ ์ˆซ์ž๋ฅผ ๋ฐฐ์—ดํ•˜๋ ค๋ฉด ๋น„๊ตํ•จ์ˆ˜๋ฅผ ์ธ์ž๋กœ ๋„ฃ์–ด์ค˜์•ผ๋˜๋Š”๋ฐ์š”return a - b ๋ฅผ ํ•˜๋ฉด ์˜ค๋ฆ„์ฐจ์ˆœreturn b - a ๋ฅผ ํ•˜๋ฉด ๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.

2016.10.16 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Fizz / Buzz

Description: Write a function that takes an integer and returns an Array [A, B, C] where A is the number of multiples of 3 (but not 5) less than the given integer, B is the number of multiples of 5 (but not 3) less than the given integer and C is the number of multiples of 3 and 5 less than the given integer. For example, solution(20) should return [5, 2, 1] 3์˜ ๋ฐฐ์ˆ˜์™€ 5์˜ ๋ฐฐ์ˆ˜ ๊ทธ๋ฆฌ๊ณ  3๊ณผ 5์˜ ๋ฐฐ์ˆ˜๊ฐ€ ๋™์‹œ์— ์ถฉ์กฑ์‹œํ‚ค๋Š” ..

2016.10.16 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Sum of odd numbers

Given the triangle of consecutive odd numbers: 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 ... Calculate the row sums of this triangle from the row index (starting at index 1) e.g.: rowSumOddNumbers(1); // 1 rowSumOddNumbers(2); // 3 + 5 = 8 ๋„ˆ๋ฌด ์–ด๋ ต๊ฒŒ ์ƒ๊ฐํ–ˆ๋‹ค..์กฐ๊ธˆ๋งŒ ๋” ์‰ฝ๊ฒŒ ์ƒ๊ฐํ–ˆ์œผ๋ฉด ํ›จ์”ฌ ์‰ฌ์šด ๋ฐฉ๋ฒ•์„ ์ƒ๊ฐํ•ด๋‚ผ ์ˆ˜ ์žˆ์—ˆ๋Š”๋ฐ..๊ฐ„๋‹จํ•˜๊ฒŒ ๋ฐ”๋กœ ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œํ•ด๊ฒฐ๋Šฅ๋ ฅ์„ ํ‚ค์šฐ๋„๋ก ๋…ธ๋ ฅํ•ด์•ผ๊ฒ ๋‹ค. ์™œ ์ด๋ฐฉ๋ฒ•์„ ์ƒ๊ฐ์„ ๋ชปํ–ˆ์„๊ผฌ...

2016.10.14 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Remove the minimum

Description: The museum of incredible dull things The museum of incredible dull things wants to get rid of some exhibitions. Miriam, the interior architect, comes up with a plan to remove the most boring exhibitions. She gives them a rating, and then removes the one with the lowest rating. However, just as she finished rating all exhibitions, she's off to an important fair, so she asks you to wr..

2016.10.14 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

๋ธ”๋กœ๊ทธ/ํ‹ฐ์Šคํ† ๋ฆฌ ํŒ

[์›นํฐํŠธ] ํ‹ฐ์Šคํ† ๋ฆฌ ๋ธ”๋กœ๊ทธ ๋‚˜๋ˆ”๋ฐ”๋ฅธ๊ณ ๋”• ํฐํŠธ ์ ์šฉ

ํ•˜๋ฃจ์— ์ ์ง€์•Š์€ ์–‘์˜ ๊ธ€๋“ค(์ฃผ๋กœ ์›นํŽ˜์ด์ง€)์„ ์ฝ๊ฒŒ ๋˜๋Š”๋ฐ ์ด๋”ฐ๊ธˆ์”ฉ ๊ธ€๊ผด์˜ ์ค‘์š”์„ฑ์„ ์‹ค๊ฐํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ €๋Š” ๊ธ€๊ผด ์ค‘์—๋„ "๋‚˜๋ˆ”๋ฐ”๋ฅธ๊ณ ๋”•"์„ ์„ ํ˜ธํ•˜๋Š”๋ฐ์š”. ํ‹ฐ์Šคํ† ๋ฆฌ ๋ธ”๋กœ๊ทธ๋ฅผ ์‹œ์ž‘ํ•˜๋ฉด์„œ ๋ธ”๋กœ๊ทธ ๋””ํดํŠธ ํฐํŠธ๋กœ ๋‚˜๋ˆ”๋ฐ”๋ฅธ๊ณ ๋”•์œผ๋กœ ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. ์›นํฐํŠธ๋กœ ํฐํŠธ๋ฅผ ์ ์šฉ์‹œ์ผฐ๊ณ , ์ ์šฉ์‹œํ‚ค๋Š” ๋ฒ•์— ๋Œ€ํ•ด์„œ ์ด์„ค๋ช…ํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค ! HTML / CSS๋ฅผ ๋ชจ๋ฅด๋Š” ์ดˆ์‹ฌ์ž๋ฅผ ๋Œ€์ƒ์œผ๋กœ ์‰ฝ๊ฒŒ ์„ค๋ช…ํ•  ์˜ˆ์ •์ด๋‹ˆ ์ด ๊ธ€์„ ์ญ‰ ๋”ฐ๋ผ์„œ ์ ์šฉํ•˜์‹œ๋ฉด ์‰ฝ๊ฒŒ ์ ์šฉํ•˜์‹ค ์ˆ˜ ์žˆ์„ ๊ฒ๋‹ˆ๋‹ค. ์™ผ์ชฝ ์ค‘๊ฐ„์ฏค์— ์žˆ๋Š” HTML / CSS ํŽธ์ง‘์„ ๋“ค์–ด๊ฐ€๋ฉด ์ด๋ ‡๊ฒŒ HTML/ CSS์„ ํŽธ์ง‘ํ•  ์ˆ˜ ์žˆ๋Š” ์—๋””ํ„ฐ๋ฅผ ๋ณด์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.์ด์ œ ์—ฌ๊ธฐ์„œ ๋ช‡ ๊ฐ€์ง€ ์ฝ”๋“œ๋ฅผ ์ ์šฉ์„ ์‹œ์ผœ์•ผ ๋˜๋Š”๋ฐ์š”. ์˜ค๋ฅธ์ชฝ HTML ๋ฌธ์„œ ํŒŒ์ผ์— ๋ถ€๋ถ„์ด ์žˆ์„๊ฒ๋‹ˆ๋‹ค. ๊ทธ ๋ฐ”๋กœ ์œ„์— ์•„๋ž˜์— ์ฝ”๋“œ๋ฅผ ์ง‘์–ด ๋„ฃ๋„๋ก ํ•˜๊ฒ ..

2016.09.22 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] IQ Test

Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob โ€” to check his answers, he needs a program that among the given numbers finds one that is different in evenness, and return a position of this number. ! Keep in mind that you..

2016.09.21 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Exes and Ohs

Description: Check to see if a string has the same amount of 'x's and 'o's. The method must return a boolean and be case insensitive. The string can contains any char. Examples input/output: XO("ooxx") => true XO("xooxx") => false XO("ooxXm") => true XO("zpzpzpp") => true // when no 'x' and 'o' is present should return true XO("zzoo") => false

2016.09.21 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Find the next perfect square!

Description: You might know some pretty large perfect squares. But what about the NEXT one? Complete the findNextSquare method that finds the next integral perfect square after the one passed as a parameter. Recall that an integral perfect square is an integer n such that sqrt(n) is also an integer. If the parameter is itself not a perfect square, than -1 should be returned. You may assume the p..

2016.09.21 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

๊ฐœ๋ฐœ/Javascript

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๊ฐ์ฒด (Javascript - Object)

์ด๋ฒˆ ๊ธ€์€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ํ•ต์‹ฌ์ด๊ธฐ๋„ ํ•˜์ง€๋งŒ, ์ดํ•ดํ•˜๊ธฐ ์–ด๋ ค์šด ๊ฐ์ฒด์— ๋Œ€ํ•ด์„œ ๋‹ค๋ค„๋ณด๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ๊ฐ์ฒด ๊ธฐ๋ฐ˜์˜ ์Šคํฌ๋ฆฝํŠธ ์–ธ์–ด์ด๋ฉฐ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ด๋ฃจ๊ณ  ์žˆ๋Š” ๊ฑฐ์˜ ๋ชจ๋“  ๊ฒƒ๋“ค์ด ๊ฐ์ฒด๋กœ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ ‡๊ธฐ ๋•Œ๋ฌธ์— ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ๊ณต๋ถ€ํ•  ๋•Œ ๊ผญ ์ •๋ณตํ•ด์•ผ ํ•ด์•ผ ํ•˜๋Š” ๊ฒƒ์ด ๋ฐ”๋กœ โ€œ๊ฐ์ฒดโ€์ด๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค. ํ•œ๋งˆ๋””๋กœ ๊ฐ์ฒด๋Š” ์ž์‹ ์˜ ์ •๋ณด๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๋…๋ฆฝ์ ์ธ ์ฃผ์ฒด์ž…๋‹ˆ๋‹ค.๊ฐ์ฒด๋ฅผ ์ดํ•ดํ•˜๋ ค๋ฉด 'ํ”„๋กœํผํ‹ฐ'์™€ '๋ฉ”์†Œ๋“œ'๋ฅผ ์ดํ•ดํ•˜๊ณ  ์žˆ์–ด์•ผํ•ฉ๋‹ˆ๋‹ค.๊ฐ์ฒด๋ž€ ๊ฒƒ์€ ๊ฒฐ๊ตญ ํฌ์žฅ์„ ์ด๋ฃจ๋Š” ๋ง์ด๊ณ  ์‹ค์ œ ๊ฐ์ฒด๋ฅผ ์™„์„ฑ์‹œ์ผœ์ฃผ๋Š” ๊ฒƒ์€ ํ”„๋กœํผํ‹ฐ์™€ ๋ฉ”์†Œ๋“œ๋ผ๋Š” ๊ตฌ์„ฑ์š”์†Œ์ด๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.์ดํ•ดํ•˜๊ธฐ ์‰ฝ๊ฒŒ ์•„๋ž˜ ๊ทธ๋ฆผ์œผ๋กœ ๊ฐ์ฒด์— ๋Œ€ํ•ด ์‰ฝ๊ฒŒ ์„ค๋ช…ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๊ฐ€ ๊ฐ์ฒด๋ผ๊ณ  ๋ถ€๋ฅด๋Š” ๊ฒƒ์€ ๋ฐ”๋กœ ์ปดํ“จํ„ฐ ์ผ€์ด์Šค์— ํ•ด๋‹นํ•˜๋Š”๋ฐ์š”. ์‹ค์ œ ์ปดํ“จํ„ฐ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ๊ฒƒ์€ ๋ฉ”๋ชจ๋ฆฌ, ๊ทธ..

2016.09.21 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Isograms

Description: An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the empty string is an isogram. Ignore letter case. isIsogram( "Dermatoglyphics" ) == true isIsogram( "aba" ) == false isIsogram( "moOse" ) == false // -- ignore letter case ๊ฐ™์€ ๋ฌธ์ž๊ฐ€ ๋‚˜์˜ค๋ฉด false๋ฅผ return..

2016.09.20 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Credit Card Mask

Description: Usually when you buy something, you're asked whether your credit card number, phone number or answer to your most secret question is still correct. However, since someone could look over your shoulder, you don't want that shown on your screen. Instead, we mask it. Your task is to write a function maskify, which changes all but the last four characters into '#'. Examples maskify("455..

2016.09.20 ๊ฒŒ์‹œ๋จ

 ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

Computer science/์•Œ๊ณ ๋ฆฌ์ฆ˜

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Descending Order

Description:Your task is to make a function that can take any non-negative integer as a argument and return it with it's digits in descending order. Descending order means that you take the highest digit and place the next highest digit immediately after it.Examples:Input: 145263 Output: 654321Input: 1254859723 Output: 9875543221 Number ๋ฐ์ดํ„ฐ ํƒ€์ž…์„ String ๋ฐ์ดํ„ฐ ํƒ€์ž…์œผ๋กœ ๋ณ€ํ™˜ ํ›„ ๋ฐฐ์—ด๋กœ ์ •๋ ฌํ•˜๊ณ  ๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ ์ •๋ ฌํ•œ ๋‹ค์Œ ๋‹ค์‹œ Numb..

2016.09.20 ๊ฒŒ์‹œ๋จ

728x90
๋ฐ˜์‘ํ˜•