English beggars
Description: Born a misinterpretation of this kata, your task here is pretty simple: given an array of values and an amount of beggars, you are supposed to return an array with the sum of what each beggar brings home, assuming they all take regular turns, from the first to the last. For example: [1,2,3,4,5] for 2 beggars will return a result of [9,6], as the first one takes [1,3,5], the second c..
2022. 3. 16.
+1 Array
Description: Given an array of integers of any length, return an array that has 1 added to the value represented by the array. the array can't be empty only non-negative, single digit integers are allowed Return nil (or your language's equivalent) for invalid inputs. Examples For example the array [2, 3, 9] equals 239, adding one would return the array [2, 4, 0]. [4, 3, 2, 5] would return [4, 3,..
2022. 3. 15.
Count the divisors of a number
Description: Count the number of divisors of a positive integer n. Random tests go up to n = 500000. Examples (input --> output) 4 --> 3 (1, 2, 4) 5 --> 2 (1, 5) 12 --> 6 (1, 2, 3, 4, 6, 12) 30 --> 8 (1, 2, 3, 5, 6, 10, 15, 30) Solution: 1. Repeat 'n' to generate numbers one after the other. 2. Check whether the generated numbers are divisible by 'n'. 3. Count the number of divisible numbers. fu..
2022. 3. 12.