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

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

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

You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters.Examples:Kata.getMiddle("test") should return "es" Kata.getMiddle("testing") should return "t" Kata.getMiddle("middle") should return "dd" Kata.getMiddle("A") should return "A"InputA word (..

2016.09.18 ๊ฒŒ์‹œ๋จ

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

๊ธฐ์ˆ  ์Šคํƒ/Javascript

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] String์„ Number ํƒ€์ž…์œผ๋กœ ๋ฐ”๊พธ๊ธฐ

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ๋ช…์‹œ์ ์ธ ๋ฐ์ดํ„ฐํƒ€์ž… ์ •์˜๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. Int๋‚˜ String๊ฐ™์ด ํƒ€์ž…์„ ๋ช…์‹œํ•ด์„œ ๋ณ€์ˆ˜๋ฅผ ์ •์˜ํ•˜์ง€ ์•Š๊ณ  ๊ทธ๋ƒฅ var ํƒ€์ž…์œผ๋กœ ์ •์˜ํ•˜๋ฉด ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์•Œ์•„์„œ ์ ์ ˆํ•œ ํƒ€์ž…์„ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ๋ช…์‹œ์ ์ธ ํƒ€์ž…์ด ์—†๋‹ค๋Š” ๊ฒƒ์€ ๋•Œ๋ก  ํƒ€์ž… ๋•Œ๋ฌธ์— ํ—ท๊ฐˆ๋ฆฌ๊ธฐ๋„ ํ•˜๊ณ  ์›์น˜ ์•Š์€ ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ค๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๋ณดํ†ต์€ ์•ฝ๊ฐ„ ํŽธ๋ฒ•์ ์ธ ๋ฐฉ๋ฒ•์œผ๋กœ String์„ number๋กœ ๋ฐ”๊พผ๋‹ค๋˜์ง€ Number๋ฅผ String์œผ๋กœ ๋ฐ”๊พผ๋‹ค๋˜์ง€ ํ•ฉ๋‹ˆ๋‹ค. ์œ„์˜ ๋ฐฉ๋ฒ•์ด ๊ฐ€์žฅ ๊ฐ„๋‹จํ•˜๊ฒŒ ํ˜•๋ณ€ํ™˜์„ ํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. ์‰ฝ๊ฒŒ ๋งํ•ด์„œ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ์ž๋™ํ˜•๋ณ€ํ™˜์„ ์ด์šฉํ•ด์„œ ์ฒ˜๋ฆฌํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ˆซ์žํƒ€์ž…์— ๋ฌธ์ž์—ด์„ ๋”ํ•˜๋ฉด ๊ฒฐ๊ณผ๊ฐ€ ๋ฌธ์ž์—ด์ด ๋˜๊ณ  ๋ฌธ์ž์—ด์— ์ˆซ์ž๋ฅผ ๊ณฑํ•˜๋ฉด ์ˆซ์žํƒ€์ž…์ด ๋˜๋Š” ํŠน์„ฑ์„ ์ด์šฉํ•ด์„œ ๊ฒฐ๊ณผ๋Š” ๋‹ฌ๋ผ์ง€์ง€ ์•Š๊ฒŒ ํƒ€์ž…๋งŒ ๋ณ€ํ™˜๋˜๋„๋ก ์ฒ˜๋ฆฌํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์˜ˆ์ œ๋ฅผ ํ•ด๋ณธ ..

2016.09.18 ๊ฒŒ์‹œ๋จ

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

๊ธฐ์ˆ  ์Šคํƒ/Javascript

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ] ๋ฐฐ์—ด ์š”์†Œ ์ค‘ ์ตœ๋Œ€๊ฐ’ ์ตœ์†Œ๊ฐ’ ์ฐพ๊ธฐ

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—๋Š” ์ˆซ์ž๋กœ ์ด๋ฃจ์–ด์ง„ ๋ฐฐ์—ด ๋‚ด์—์„œ ๊ฐ€์žฅ ํฐ ์ˆซ์ž ํ˜น์€ ๊ฐ€์žฅ ์ž‘์€ ์ˆซ์ž๋ฅผ ์ฐพ์•„์•ผ ํ•  ๊ฒฝ์šฐ for๋ฌธ์„ ๋Œ๋ฆฌ๋Š” ๋‹จ์ˆœํ•œ ๋ฐฉ๋ฒ• ์™ธ์— ๋” ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์ด ์กด์žฌํ•ฉ๋‹ˆ๋‹ค! ๋จผ์ € Math ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค. Math ๊ฐ์ฒด์— ๊ฐ€์žฅ ํฐ ์ˆซ์ž, ๊ฐ€์žฅ ์ž‘์€ ์ˆซ์ž๋ฅผ ๊ตฌํ•˜๋Š” max, min ๋ฉ”์„œ๋“œ๊ฐ€ ์กด์žฌํ•˜๋Š”๋ฐ ์—ฌ๊ธฐ์— apply ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ˆซ์ž๋กœ ์ด๋ฃจ์–ด์ง„ ๋ฐฐ์—ด์„ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์˜ ์˜ˆ์‹œ๋ฅผ ๋ณด๋ฉด ์ดํ•ดํ•˜๊ธฐ ์‰ฌ์šธ๊ฒ๋‹ˆ๋‹ค. ํ•œ ๊ฐ€์ง€ ์กฐ์‹ฌํ•ด์•ผํ•  ๋ถ€๋ถ„์ด ์žˆ๋Š”๋ฐ, ๋ฐฐ์—ด ๋‚ด์— ๋น„๊ต ๋ถˆ๊ฐ€๋Šฅํ•œ ๊ฐ’์ด ์žˆ๋‹ค๋ฉด ๊ฒฐ๊ณผ๋Š” NaN์œผ๋กœ ๋‚˜์˜ค๊ฒŒ ๋จ์„ ์ฃผ์˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

2016.09.18 ๊ฒŒ์‹œ๋จ

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

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

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

In this little assignment you are given a string of space separated numbers, and have to return the highest and lowest number.Example:highAndLow("1 2 3 4 5"); // return "5 1"highAndLow("1 2 -3 4 5"); // return "5 -3"highAndLow("1 9 3 4 -5"); // return "9 -5" Notes:ยท All numbers are valid Int32, no need to validate them.ยท There will always be at least one number in the input string. ยท Output stri..

2016.09.18 ๊ฒŒ์‹œ๋จ

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

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

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

Description: Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions" for the development and functioning of living organisms. If you want to know more http://en.wikipedia.org/wiki/DNA In DNA strings, symbols "A" and "T" are complements of each other, as "C" and "G". You have function with one side of the DNA (string, except for Haskell); you need to..

2016.09.17 ๊ฒŒ์‹œ๋จ

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

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

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

Description: write me a function stringy that takes a size and returns a string of alternating '1s' and '0s'. the string should start with a 1. a string with size 6 should return :'101010'. with size 4 should return : '1010'. with size 12 should return : '101010101010'. The size will always be positive and will only use whole numbers.

2016.09.17 ๊ฒŒ์‹œ๋จ

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

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

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

Trolls are attacking your comment section! A common way to deal with this situation is to remove all of the vowels from the trolls' comments, neutralizing the threat. Your task is to write a function that takes a string and return a new string with all vowels removed. For example, the string "This website is for losers LOL!" would become "Ths wbst s fr lsrs LL!". ๋ชจ์Œ๋งŒ ์ œ๊ฑฐํ•˜๋Š” ์˜ˆ์ œ๋‹ค. ์ •๊ทœํ‘œํ˜„์‹ /[aeiou]/ gi..

2016.09.17 ๊ฒŒ์‹œ๋จ

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

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

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Beginner Series #3 Sum of Numbers

Given two integers, which can be positive and negative, find the sum of all the numbers between including them too and return it. If both numbers are equal return a or b. Note! a and b are not ordered! Example: GetSum(1, 0) == 1 // 1 + 0 = 1 GetSum(1, 2) == 3 // 1 + 2 = 3 GetSum(0, 1) == 1 // 0 + 1 = 1 GetSum(1, 1) == 1 // 1 Since both are same GetSum(-1, 0) == -1 // -1 + 0 = -1 GetSum(-1, 2) ==..

2016.09.17 ๊ฒŒ์‹œ๋จ

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

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

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

In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative? Example: makeNegative(1); // return -1 makeNegative(-5); // return -5 makeNegative(0); // return 0 Notes: The number can be negative already, in which case no change is required. Zero (0) can't be negative, see examples above.

2016.09.17 ๊ฒŒ์‹œ๋จ

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

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

[์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๊ตฌํ˜„ํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜] Convert number to reversed array of digits

Description: Convert number to reversed array of digits Given a random number: C#: long; C++: unsigned long; You have to return the digits of this number within an array in reverse order. Example: 348597 => [7,9,5,8,4,3] ํ›จ์”ฌ ๋” ์ƒ์‚ฐ์ ์ธ ์ฝ”๋“œ๋กœ ๊ฐœ์„ ํ•˜์ž๋ฉด ๋งŽ์ด ๋ฐฐ์›Œ๊ฐ‘๋‹ˆ๋‹ค.

2016.09.14 ๊ฒŒ์‹œ๋จ

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

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

Create a function with two arguments that will return a list of length (n) with multiples of (x). Assume both the given number and the number of times to count will be positive numbers greater than 0.Return the results as an array (or list in Python, Haskell or Elixir). Examples: countBy(1,10) === [1,2,3,4,5,6,7,8,9,10] countBy(2,5) === [2,4,6,8,10] ์ด๋Ÿฐ ๋ฐฉ๋ฒ•์œผ๋กœ ์ฒซ ์ฝ”๋”ฉ์„ ์ž‘์„ฑํ–ˆ๋‹ค. ์ข€ ๋” ๋ณด๊ธฐ ์ข‹์€ ์ฝ”๋“œ๋กœ๋Š” ์ด๋ ‡๊ฒŒ ์ž‘์„ฑ๋„ ๊ฐ€๋Šฅํ•˜๋‹ค.

2016.09.12 ๊ฒŒ์‹œ๋จ

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

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

Description: Finish the uefaEuro2016() function so it return string just like in the examples below: uefaEuro2016(['Germany', 'Ukraine'],[2, 0]) // "At match Germany - Ukraine, Germany won!" uefaEuro2016(['Belgium', 'Italy'],[0, 2]) // "At match Belgium - Italy, Italy won!" uefaEuro2016(['Portugal', 'Iceland'],[1, 1]) // "At match Portugal - Iceland, teams played draw."

2016.09.12 ๊ฒŒ์‹œ๋จ

728x90
๋ฐ˜์‘ํ˜•