[CodeWars] Decode the Morse Code

Part of Series 1/3This kata is part of a series on the Morse code. After you solve this kata, you may move to the next one.
In this kata you have to write a simple Morse code decoder. While the Morse code is now mostly superceded by voice and digital data communication channels, it still has its use in some applications around the world.

더 보기

[CodeWars] Find the Parity Outlier

You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this “outlier” N.

계속 “[CodeWars] Find the Parity Outlier” 읽기

[CodeWars] Sum of Digits / Digital Root

In this kata, you must create a digital root function.

A digital root is the recursive sum of all the digits in a number. Given n, take the sum of the digits of n. If that value has two digits, continue reducing in this way until a single-digit number is produced. This is only applicable to the natural numbers.


[CodeWars] Playing with digits

Some numbers have funny properties. For example:

89 –> 8¹ + 9² = 89 * 1

695 –> 6² + 9³ + 5⁴= 1390 = 695 * 2

46288 –> 4³ + 6⁴+ 2⁵ + 8⁶ + 8⁷ = 2360688 = 46288 * 51

Given a positive integer n written as abcd… (a, b, c, d… being digits) and a positive integer p we want to find a positive integer k, if it exists, such as the sum of the digits of n taken to the successive powers of p is equal to k * n. In other words:

Is there an integer k such as : (a ^ p + b ^ (p+1) + c ^(p+2) + d ^ (p+3) + …) = n * k

If it is the case we will return k, if not return -1.


알고리즘 지식 – 시간복잡도란?

프로그램이 실행되는 데 걸리는 시간을 대략적으로 나타낸 것.
알고리즘의 효율을 나타내기 위해 사용된다.

왜 쓰는가?

더 품질이 좋은 코드를 만들기 위해서. 게임 개발과 같이 실행 시간이 매우 중요한 분야에서는 코드의 실행 시간을 대략적으로 측정해 쓸데없이 긴 시간을 소요하는 코드를 리팩토링하기 위해서 시간복잡도가  필수적으로 필요하다.
계속 “알고리즘 지식 – 시간복잡도란?” 읽기