본문 바로가기

알고리즘/CodeWars13

[CodeWars] javascript - 6kyu - IQ Test 문제풀이 Title IQ Test Description 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 numbe.. 2020. 4. 21.
[CodeWars] javascript - 7kyu - Growth Of Population 문제풀이 Title Growth Of Population Description In a small town the population is p0 = 1000 at the beginning of a year. The population regularly increases by 2 percent per year and moreover 50 new inhabitants per year come to live in the town. How many years does the town need to see its population greater or equal to p = 1200 inhabitants? At the end of the first year there will be: 1000 + 1000 * 0.02 + .. 2020. 4. 14.
[CodeWars] javascript - 8kyu - Find the first non-consecutive number 문제풀이 Title Find the first non-consecutive number Description Your task is to find the first element of an array that is not consecutive. By not consecutive we mean not exactly 1 larger than the previous element of the array. E.g. If we have an array [1,2,3,4,6,7,8] then 1 then 2 then 3 then 4 are all consecutive but 6 is not, so that's the first non-consecutive number. If the whole array is consecuti.. 2020. 4. 13.
[CodeWars] javascript - 6kyu - Sum of Digits / Digital Root 문제풀이 Title Sum of Digits / Digital Root Description 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 more than one digit, continue reducing in this way until a single-digit number is produced. This is only applicable to the natural numbers. Here's how it works: digital_.. 2020. 4. 12.