[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.

More

[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.

More

[C++] 클래스

개요


C++11 버전 이후로 도입된 개념으로서, 객체 지향 프로그래밍(OOP)를 도입하면서 생겨난 개념입니다.

C++의 클래스는 간단하게 말해서, C++의 클래스는 C언어의 구조체의 확장형이라고 할 수 있습니다.

기존의 구조체는 변수만 담을 수 있었다면, 클래스에서는 함수도 담을 수 있습니다.

계속 “[C++] 클래스” 읽기