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.
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
계속 “[CodeWars] Find the Parity Outlier” 읽기
N. Write a method that takes the array as an argument and returns this “outlier”
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.
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.
C++11 버전 이후로 도입된 개념으로서, 객체 지향 프로그래밍(OOP)를 도입하면서 생겨난 개념입니다.
C++의 클래스는 간단하게 말해서, C++의 클래스는 C언어의 구조체의 확장형이라고 할 수 있습니다.
기존의 구조체는 변수만 담을 수 있었다면, 클래스에서는 함수도 담을 수 있습니다.
계속 “[C++] 클래스” 읽기
You are going to be given an array of integers. Your job is to take that array and find an index N where the sum of the integers to the left of N is equal to the sum of the integers to the right of N. If there is no index that would make this happen, return
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.