id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_3700
A family of kookaburras are in my backyard. I can't see them all, but I can hear them! # How many kookaburras are there? ## Hint The trick to counting kookaburras is to listen carefully * The males go ```HaHaHa```... * The females go ```hahaha```... * And they always alternate male/female ^ Kata Note : No...
apps_data_3701
Write a function that calculates the *least common multiple* of its arguments; each argument is assumed to be a non-negative integer. In the case that there are no arguments (or the provided array in compiled languages is empty), return `1`. ~~~if:objc NOTE: The first (and only named) argument of the function `n` spec...
apps_data_3702
To celebrate the start of the Rio Olympics (and the return of 'the Last Leg' on C4 tonight) this is an Olympic inspired kata. Given a string of random letters, you need to examine each. Some letters naturally have 'rings' in them. 'O' is an obvious example, but 'b', 'p', 'e', 'A', etc are all just as applicable. 'B' e...
apps_data_3703
The pizza store wants to know how long each order will take. They know: - Prepping a pizza takes 3 mins - Cook a pizza takes 10 mins - Every salad takes 3 mins to make - Every appetizer takes 5 mins to make - There are 2 pizza ovens - 5 pizzas can fit in a oven - Prepping for a pizza must be done before it can be put ...
apps_data_3704
# Solve For X You will be given an equation as a string and you will need to [solve for X](https://www.mathplacementreview.com/algebra/basic-algebra.php#solve-for-a-variable) and return x's value. For example: ```python solve_for_x('x - 5 = 20') # should return 25 solve_for_x('20 = 5 * x - 5') # should return 5 solv...
apps_data_3705
Write function heron which calculates the area of a triangle with sides a, b, and c. Heron's formula: sqrt (s \* (s - a) \* (s - b) \* (s - c)), where s = (a + b + c) / 2. Output should have 2 digits precision. import math def heron(a,b,c): s=(a+b+c)/2 return round(math.sqrt(s*(s-a)*(s-b)*(s - c)),2) def her...
apps_data_3706
Assume that you started to store items in progressively expanding square location, like this for the first 9 numbers: ``` 05 04 03 06 01 02 07 08 09 ``` And like this for the expanding to include up to the first 25 numbers: ``` 17 16 15 14 13 18 05 04 03 12 19 06 01 02 11 20 07 08 09 10 21 22 23 24 25 ``` You might...
apps_data_3707
HELP! Jason can't find his textbook! It is two days before the test date, and Jason's textbooks are all out of order! Help him sort a list (ArrayList in java) full of textbooks by subject, so he can study before the test. The sorting should **NOT** be case sensitive def sorter(textbooks): return sorted(textbooks,...
apps_data_3708
Complete the function which converts hex number (given as a string) to a decimal number. def hex_to_dec(s): return int(s, 16) from functools import partial hex_to_dec = partial(int, base=16) def hex_to_dec(s): key = "0123456789abcdef" n=0 res=0 for l in s[::-1]: res += key.index(l)*(16.**...
apps_data_3709
This kata is about multiplying a given number by eight if it is an even number and by nine otherwise. def simple_multiplication(number) : return number * 9 if number % 2 else number * 8 def simple_multiplication(n) : return n * (8 + n%2) def simple_multiplication(number) : return number * (8 if number % ...
apps_data_3710
This is the performance edition of [this kata](https://www.codewars.com/kata/ulam-sequences). If you didn't do it yet, you should begin there. --- The Ulam sequence U is defined by `u0=u`, `u1=v`, with the general term `u_n` for `n>2` given by the least integer expressible uniquely as the sum of two distinct earlier ...
apps_data_3711
Create a function xMasTree(height) that returns a christmas tree of the correct height. The height is passed through to the function and the function should return a list containing each line of the tree. ``` xMasTree(5) should return : ['____#____', '___###___', '__#####__', '_#######_', '#########', '____#____', '__...
apps_data_3712
## Task Your challenge is to write a function named `getSlope`/`get_slope`/`GetSlope` that calculates the slope of the line through two points. ## Input ```if:javascript,python Each point that the function takes in is an array 2 elements long. The first number is the x coordinate and the second number is the y coord...
apps_data_3713
An ordered sequence of numbers from 1 to N is given. One number might have deleted from it, then the remaining numbers were mixed. Find the number that was deleted. Example: - The starting array sequence is `[1,2,3,4,5,6,7,8,9]` - The mixed array with one deleted number is `[3,2,4,6,7,8,1,9]` - Your function shoul...
apps_data_3714
In this kata, you need to make a (simplified) LZ78 encoder and decoder. [LZ78](https://en.wikipedia.org/wiki/LZ77_and_LZ78#LZ78) is a dictionary-based compression method created in 1978. You will find a detailed explanation about how it works below. The input parameter will always be a non-empty string of upper case ...
apps_data_3715
# Task The sequence of `Chando` is an infinite sequence of all Chando's numbers in ascending order. A number is called `Chando's` if it is an integer that can be represented as a sum of different positive integer powers of 5. The first Chando's numbers is 5 (5^1). And the following nth Chando's numbers are: ``` ...
apps_data_3716
In another Kata I came across a weird `sort` function to implement. We had to sort characters as usual ( 'A' before 'Z' and 'Z' before 'a' ) except that the `numbers` had to be sorted **after** the `letters` ( '0' after 'z') !!! (After a couple of hours trying to solve this unusual-sorting-kata I discovered final test...
apps_data_3717
Given a list of white pawns on a chessboard (any number of them, meaning from 0 to 64 and with the possibility to be positioned everywhere), determine how many of them have their backs covered by another. Pawns attacking upwards since we have only white ones. Please remember that a pawn attack(and defend as well) onl...
apps_data_3718
Count the number of divisors of a positive integer `n`. Random tests go up to `n = 500000`. ## Examples ```python divisors(4) == 3 # 1, 2, 4 divisors(5) == 2 # 1, 5 divisors(12) == 6 # 1, 2, 3, 4, 6, 12 divisors(30) == 8 # 1, 2, 3, 5, 6, 10, 15, 30 ``` def divisors(n): return len([l_div for l_div in range...
apps_data_3719
For a pole vaulter, it is very important to begin the approach run at the best possible starting mark. This is affected by numerous factors and requires fine-tuning in practice. But there is a guideline that will help a beginning vaulter start at approximately the right location for the so-called "three-step approach,"...
apps_data_3720
Complete the function that accepts a valid string and returns an integer. Wait, that would be too easy! Every character of the string should be converted to the hex value of its ascii code, then the result should be the sum of the numbers in the hex strings (ignore letters). ## Examples ``` "Yo" ==> "59 6f" ==> 5 + 9...
apps_data_3721
Count how often sign changes in array. ### result number from `0` to ... . Empty array returns `0` ### example def catch_sign_change(lst): count = 0 for i in range(1,len(lst)): if lst[i] < 0 and lst[i-1] >= 0:count += 1 if lst[i] >= 0 and lst[i-1] < 0:count += 1 return count def catch_si...
apps_data_3722
Create a function that returns the average of an array of numbers ("scores"), rounded to the nearest whole number. You are not allowed to use any loops (including for, for/in, while, and do/while loops). def average(array): return round(sum(array) / len(array)) from statistics import mean def average(array): ...
apps_data_3723
## Task You are given an array of integers. On each move you are allowed to increase exactly one of its element by one. Find the minimal number of moves required to obtain a strictly increasing sequence from the input. ## Example For `arr = [1, 1, 1]`, the output should be `3`. ## Input/Output - `[input]` integ...
apps_data_3724
A hero is on his way to the castle to complete his mission. However, he's been told that the castle is surrounded with a couple of powerful dragons! each dragon takes 2 bullets to be defeated, our hero has no idea how many bullets he should carry.. Assuming he's gonna grab a specific given number of bullets and move fo...
apps_data_3725
You are given two strings. In a single move, you can choose any of them, and delete the first (i.e. leftmost) character. For Example: * By applying a move to the string `"where"`, the result is the string `"here"`. * By applying a move to the string `"a"`, the result is an empty string `""`. Implement a function tha...
apps_data_3726
You have an array of numbers. Your task is to sort ascending odd numbers but even numbers must be on their places. Zero isn't an odd number and you don't need to move it. If you have an empty array, you need to return it. *Example* ```python sort_array([5, 3, 2, 8, 1, 4]) == [1, 3, 2, 8, 5, 4] ``` def sort_array(a...
apps_data_3727
# Pythagorean Triples A Pythagorean triplet is a set of three numbers a, b, and c where `a^2 + b^2 = c^2`. In this Kata, you will be tasked with finding the Pythagorean triplets whose product is equal to `n`, the given argument to the function `pythagorean_triplet`. ## Your task In this Kata, you will be tasked with...
apps_data_3728
Write function describeList which returns "empty" if the list is empty or "singleton" if it contains only one element or "longer"" if more. def describeList(lst): return ["empty","singleton","longer"][min(len(lst),2)] def describeList(list): return "empty" if not list else "singleton" if len(list) == 1 else "...
apps_data_3729
Define n!! as n!! = 1 \* 3 \* 5 \* ... \* n if n is odd, n!! = 2 \* 4 \* 6 \* ... \* n if n is even. Hence 8!! = 2 \* 4 \* 6 \* 8 = 384, there is no zero at the end. 30!! has 3 zeros at the end. For a positive integer n, please count how many zeros are there at the end of n!!. Example: count\_zeros\_n\_d...
apps_data_3730
Given a string, capitalize the letters that occupy even indexes and odd indexes separately, and return as shown below. Index `0` will be considered even. For example, `capitalize("abcdef") = ['AbCdEf', 'aBcDeF']`. See test cases for more examples. The input will be a lowercase string with no spaces. Good luck! If y...
apps_data_3731
This is simple version of harder [Square Sums](/kata/square-sums). # Square sums Write function `square_sums_row` (or `squareSumsRow`/`SquareSumsRow` depending on language rules) that, given integer number `N` (in range `2..43`), returns array of integers `1..N` arranged in a way, so sum of each 2 consecutive numbers...
apps_data_3732
A Madhav array has the following property: ```a[0] = a[1] + a[2] = a[3] + a[4] + a[5] = a[6] + a[7] + a[8] + a[9] = ...``` Complete the function/method that returns `true` if the given array is a Madhav array, otherwise it returns `false`. *Edge cases: An array of length* `0` *or* `1` *should not be considered a Mad...
apps_data_3733
In your class, you have started lessons about [arithmetic progression](https://en.wikipedia.org/wiki/Arithmetic_progression). Since you are also a programmer, you have decided to write a function that will return the first `n` elements of the sequence with the given common difference `d` and first element `a`. Note tha...
apps_data_3734
# The die is cast! Your task in this kata is to write a "dice roller" that interprets a subset of [dice notation](http://en.wikipedia.org/wiki/Dice_notation). # Description In most role-playing games, die rolls required by the system are given in the form `AdX`. `A` and `X` are variables, separated by the letter **d...
apps_data_3735
You will get an array of numbers. Every preceding number is smaller than the one following it. Some numbers will be missing, for instance: ``` [-3,-2,1,5] //missing numbers are: -1,0,2,3,4 ``` Your task is to return an array of those missing numbers: ``` [-1,0,2,3,4] ``` def find_missing_numbers(arr): if not ar...
apps_data_3736
Your task is to make two functions, ```max``` and ```min``` (`maximum` and `minimum` in PHP and Python) that take a(n) array/vector of integers ```list``` as input and outputs, respectively, the largest and lowest number in that array/vector. #Examples ```python maximun([4,6,2,1,9,63,-134,566]) returns 566 minimun([-5...
apps_data_3737
**Steps** 1. Square the numbers that are greater than zero. 2. Multiply by 3 every third number. 3. Multiply by -1 every fifth number. 4. Return the sum of the sequence. **Example** `{ -2, -1, 0, 1, 2 }` returns `-6` ``` 1. { -2, -1, 0, 1 * 1, 2 * 2 } 2. { -2, -1, 0 * 3, 1, 4 } 3. { -2, -1, 0, 1, -1 * 4 } 4. -6 ```...
apps_data_3738
# Task In the city, a bus named Fibonacci runs on the road every day. There are `n` stations on the route. The Bus runs from station1 to stationn. At the departure station(station1), `k` passengers get on the bus. At the second station(station2), a certain number of passengers get on and the same number get off. T...
apps_data_3739
Similar setting of the [previous](https://www.codewars.com/kata/progressive-spiral-number-position/), this time you are called to identify in which "branch" of the spiral a given number will end up. Considering a square of numbers disposed as the 25 items in [the previous kata](https://www.codewars.com/kata/progressiv...
apps_data_3740
###Instructions A time period starting from ```'hh:mm'``` lasting until ```'hh:mm'``` is stored in an array: ``` ['08:14', '11:34'] ``` A set of different time periods is then stored in a 2D Array like so, each in its own sub-array: ``` [['08:14','11:34'], ['08:16','08:18'], ['22:18','01:14'], ['09:30','10:32'], ['04:...
apps_data_3741
Calculate the number of items in a vector that appear at the same index in each vector, with the same value. ```python vector_affinity([1, 2, 3, 4, 5], [1, 2, 2, 4, 3]) # => 0.6 vector_affinity([1, 2, 3], [1, 2, 3]) # => 1.0 ``` Affinity value should be realized on a scale of 0.0 to 1.0, with 1.0 being absolut...
apps_data_3742
You probably know that the "mode" of a set of data is the data point that appears most frequently. Looking at the characters that make up the string `"sarsaparilla"` we can see that the letter `"a"` appears four times, more than any other letter, so the mode of `"sarsaparilla"` is `"a"`. But do you know what happens w...
apps_data_3743
A grid is a perfect starting point for many games (Chess, battleships, Candy Crush!). Making a digital chessboard I think is an interesting way of visualising how loops can work together. Your task is to write a function that takes two integers `rows` and `columns` and returns a chessboard pattern as a two dimensiona...
apps_data_3744
Integral numbers can be even or odd. Even numbers satisfy `n = 2m` ( with `m` also integral ) and we will ( completely arbitrarily ) think of odd numbers as `n = 2m + 1`. Now, some odd numbers can be more odd than others: when for some `n`, `m` is more odd than for another's. Recursively. :] Even numbers are just ...
apps_data_3745
# Introduction The Condi (Consecutive Digraphs) cipher was introduced by G4EGG (Wilfred Higginson) in 2011. The cipher preserves word divisions, and is simple to describe and encode, but it's surprisingly difficult to crack. # Encoding Algorithm The encoding steps are: - Start with an `initial key`, e.g. `cryptogra...
apps_data_3746
There were and still are many problem in CW about palindrome numbers and palindrome strings. We suposse that you know which kind of numbers they are. If not, you may search about them using your favourite search engine. In this kata you will be given a positive integer, ```val``` and you have to create the function ``...
apps_data_3747
Implement `String#ipv4_address?`, which should return true if given object is an IPv4 address - four numbers (0-255) separated by dots. It should only accept addresses in canonical representation, so no leading `0`s, spaces etc. from re import compile, match REGEX = compile(r'((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){...
apps_data_3748
# Task A common way for prisoners to communicate secret messages with each other is to encrypt them. One such encryption algorithm goes as follows. You take the message and place it inside an `nx6` matrix (adjust the number of rows depending on the message length) going from top left to bottom right (one row at a ti...
apps_data_3749
# Write Number in Expanded Form You will be given a number and you will need to return it as a string in [Expanded Form](https://www.mathplacementreview.com/arithmetic/whole-numbers.php#expanded-form). For example: ```python expanded_form(12) # Should return '10 + 2' expanded_form(42) # Should return '40 + 2' expande...
apps_data_3750
Bob is a lazy man. He needs you to create a method that can determine how many ```letters``` and ```digits``` are in a given string. Example: "hel2!lo" --> 6 "wicked .. !" --> 6 "!?..A" --> 1 def count_letters_and_digits(s): return isinstance(s, str) and sum(map(str.isalnum, s)) def count_letters_and_digi...
apps_data_3751
Complete the method that takes a boolean value and return a `"Yes"` string for `true`, or a `"No"` string for `false`. def bool_to_word(bool): return "Yes" if bool else "No" def bool_to_word(bool): if bool: return "Yes" return "No" def bool_to_word(bool): if bool: return 'Yes' ...
apps_data_3752
The Binomial Form of a polynomial has many uses, just as the standard form does. For comparison, if p(x) is in Binomial Form and q(x) is in standard form, we might write p(x) := a0 \* xC0 + a1 \* xC1 + a2 \* xC2 + ... + aN \* xCN q(x) := b0 + b1 \* x + b2 \* x^(2) + ... + bN \* x^(N) Both forms have tricks for eval...
apps_data_3753
```if-not:swift Write simple .camelCase method (`camel_case` function in PHP, `CamelCase` in C# or `camelCase` in Java) for strings. All words must have their first letter capitalized without spaces. ``` ```if:swift Write a simple `camelCase` function for strings. All words must have their first letter capitalized and ...
apps_data_3754
# Task We know that some numbers can be split into two primes. ie. `5 = 2 + 3, 10 = 3 + 7`. But some numbers are not. ie. `17, 27, 35`, etc.. Given a positive integer `n`. Determine whether it can be split into two primes. If yes, return the maximum product of two primes. If not, return `0` instead. # Input/Output ...
apps_data_3755
Sort the given strings in alphabetical order, case **insensitive**. For example: ``` ["Hello", "there", "I'm", "fine"] --> ["fine", "Hello", "I'm", "there"] ["C", "d", "a", "B"]) --> ["a", "B", "C", "d"] ``` def sortme(words): return sorted(words, key=str.lower) def sortme(words): return sorte...
apps_data_3756
German mathematician Christian Goldbach (1690-1764) [conjectured](https://en.wikipedia.org/wiki/Goldbach%27s_conjecture) that every even number greater than 2 can be represented by the sum of two prime numbers. For example, `10` can be represented as `3+7` or `5+5`. Your job is to make the function return a list conta...
apps_data_3757
Given an array of numbers, return an array, with each member of input array rounded to a nearest number, divisible by 5. For example: ``` roundToFive([34.5, 56.2, 11, 13]); ``` should return ``` [35, 55, 10, 15] ``` ```if:python Roundings have to be done like "in real life": `22.5 -> 25` ``` from decimal import Deci...
apps_data_3758
You will be given an array of strings. The words in the array should mesh together where one or more letters at the end of one word will have the same letters (in the same order) as the next word in the array. But, there are times when all the words won't mesh. Examples of meshed words: "apply" and "plywood" ...
apps_data_3759
# Introduction and Warm-up (Highly recommended) # [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays) ___ # Task **_Given_** an *array/list [] of integers* , **_Construct_** a *product array **_Of same size_** Such That prod[i] is equal to The Product of all the e...
apps_data_3760
Scheduling is how the processor decides which jobs (processes) get to use the processor and for how long. This can cause a lot of problems. Like a really long process taking the entire CPU and freezing all the other processes. One solution is Round-Robin, which today you will be implementing. Round-Robin works by queu...
apps_data_3761
# Task Mirko has been moving up in the world of basketball. He started as a mere spectator, but has already reached the coveted position of the national team coach! Mirco is now facing a difficult task: selecting five primary players for the upcoming match against Tajikistan. Since Mirko is incredibly lazy, he doesn...
apps_data_3762
### Task: You have to write a function `pattern` which creates the following pattern (See Examples) upto desired number of rows. If the Argument is `0` or a Negative Integer then it should return `""` i.e. empty string. ### Examples: `pattern(9)`: 123456789 234567891 345678912 456789123 5678912...
apps_data_3763
You are required to create a simple calculator that returns the result of addition, subtraction, multiplication or division of two numbers. Your function will accept three arguments: The first and second argument should be numbers. The third argument should represent a sign indicating the operation to perform on these...
apps_data_3764
When multiple master devices are connected to a single bus (https://en.wikipedia.org/wiki/System_bus), there needs to be an arbitration in order to choose which of them can have access to the bus (and 'talk' with a slave). We implement here a very simple model of bus mastering. Given `n`, a number representing the num...
apps_data_3765
Algorithmic predicament - Bug Fixing #9 Oh no! Timmy's algorithim has gone wrong! help Timmy fix his algorithim! Task Your task is to fix timmy's algorithim so it returns the group name with the highest total age. You will receive two groups of `people` objects, with two properties `name` and `age`. The name prope...
apps_data_3766
~~~if-not:java You have to code a function **getAllPrimeFactors** wich take an integer as parameter and return an array containing its prime decomposition by ascending factors, if a factors appears multiple time in the decomposition it should appear as many time in the array. exemple: `getAllPrimeFactors(100)` return...
apps_data_3767
Coding decimal numbers with factorials is a way of writing out numbers in a base system that depends on factorials, rather than powers of numbers. In this system, the last digit is always `0` and is in base 0!. The digit before that is either `0 or 1` and is in base 1!. The digit before that is either `0, 1, or 2` a...
apps_data_3768
Naming multiple files can be a pain sometimes. #### Task: Your job here is to create a function that will take three parameters, `fmt`, `nbr` and `start`, and create an array of `nbr` elements formatted according to `frm` with the starting index `start`. `fmt` will have `` inserted at various locations; this is where...
apps_data_3769
# RoboScript #2 - Implement the RS1 Specification ## Disclaimer The story presented in this Kata Series is purely fictional; any resemblance to actual programming languages, products, organisations or people should be treated as purely coincidental. ## About this Kata Series This Kata Series is based on a fictional...
apps_data_3770
Hello! Your are given x and y and 2D array size tuple (width, height) and you have to: Calculate the according index in 1D space (zero-based). Do reverse operation. Implement: to_1D(x, y, size): --returns index in 1D space to_2D(n, size) --returns x and y in 2D space 1D array: [0, 1, 2, 3, 4, 5, 6, 7, 8] 2D arra...
apps_data_3771
Congratulations! That Special Someone has given you their phone number. But WAIT, is it a valid number? Your task is to write a function that verifies whether a given string contains a valid British mobile (cell) phone number or not. If valid, return 'In with a chance'. If invalid, or if you're given an empty str...
apps_data_3772
In genetics a reading frame is a way to divide a sequence of nucleotides (DNA bases) into a set of consecutive non-overlapping triplets (also called codon). Each of this triplets is translated into an amino-acid during a translation process to create proteins. In a single strand of DNA you find 3 Reading frames, for e...
apps_data_3773
Now we will confect a reagent. There are eight materials to choose from, numbered 1,2,..., 8 respectively. We know the rules of confect: ``` material1 and material2 cannot be selected at the same time material3 and material4 cannot be selected at the same time material5 and material6 must be selected at the same time ...
apps_data_3774
Define a function that takes one integer argument and returns logical value `true` or `false` depending on if the integer is a prime. Per Wikipedia, a prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. ## Requirements * You can assume you will be given...
apps_data_3775
Determine the total number of digits in the integer (`n>=0`) given as input to the function. For example, 9 is a single digit, 66 has 2 digits and 128685 has 6 digits. Be careful to avoid overflows/underflows. All inputs will be valid. def digits(n): return len(str(n)) from math import log10,ceil def digits(n):...
apps_data_3776
# Task Given some points(array `A`) on the same line, determine the minimum number of line segments with length `L` needed to cover all of the given points. A point is covered if it is located inside some segment or on its bounds. # Example For `A = [1, 3, 4, 5, 8]` and `L = 3`, the output should be `2`. Check ou...
apps_data_3777
A checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used for detecting transmission errors, validating document contents, and in many other situations where it is necessary to detect undesira...
apps_data_3778
Given an array of integers your solution should find the smallest integer. For example: - Given `[34, 15, 88, 2]` your solution will return `2` - Given `[34, -345, -1, 100]` your solution will return `-345` You can assume, for the purpose of this kata, that the supplied array will not be empty. def find_smallest_i...
apps_data_3779
Clock shows 'h' hours, 'm' minutes and 's' seconds after midnight. Your task is to make 'Past' function which returns time converted to milliseconds. ## Example: ```python past(0, 1, 1) == 61000 ``` Input constraints: `0 <= h <= 23`, `0 <= m <= 59`, `0 <= s <= 59` def past(h, m, s): return (3600*h + 60*m + s) ...
apps_data_3780
Given an Array and an Example-Array to sort to, write a function that sorts the Array following the Example-Array. Assume Example Array catalogs all elements possibly seen in the input Array. However, the input Array does not necessarily have to have all elements seen in the Example. Example: Arr: [1,3,4,4,4,4,5] E...
apps_data_3781
You should have done Product Partitions I to do this second part. If you solved it, you should have notice that we try to obtain the multiplicative partitions with ```n ≤ 100 ```. In this kata we will have more challenging values, our ```n ≤ 10000```. So, we need a more optimized a faster code. We need the function ...
apps_data_3782
Given an array with exactly 5 strings `"a"`, `"b"` or `"c"` (`char`s in Java, `character`s in Fortran), check if the array contains three and two of the same values. ## Examples ``` ["a", "a", "a", "b", "b"] ==> true // 3x "a" and 2x "b" ["a", "b", "c", "b", "c"] ==> false // 1x "a", 2x "b" and 2x "c" ["a", "a", "a"...
apps_data_3783
``` ************************* * Create a frame! * * __ __ * * / \~~~/ \ * * ,----( .. ) * * / \__ __/ * * /| (\ |( * * ^ \ /___\ /\ | * * |__| |__|-.. * ************************* ``` Given an array of strings and a character to be use...
apps_data_3784
Given an array of numbers, return a string made up of four parts: a) a four character 'word', made up of the characters derived from the first two and last two numbers in the array. order should be as read left to right (first, second, second last, last), b) the same as above, post sorting the array into ascending or...
apps_data_3785
Create a function that returns an array containing the first `l` digits from the `n`th diagonal of [Pascal's triangle](https://en.wikipedia.org/wiki/Pascal's_triangle). `n = 0` should generate the first diagonal of the triangle (the 'ones'). The first number in each diagonal should be 1. If `l = 0`, return an empty a...
apps_data_3786
# Do you ever wish you could talk like Siegfried of KAOS ? ## YES, of course you do! https://en.wikipedia.org/wiki/Get_Smart # Task Write the function ```siegfried``` to replace the letters of a given sentence. Apply the rules using the course notes below. Each week you will learn some more rules. Und by ze fif...
apps_data_3787
Many people choose to obfuscate their email address when displaying it on the Web. One common way of doing this is by substituting the `@` and `.` characters for their literal equivalents in brackets. Example 1: ``` user_name@example.com => user_name [at] example [dot] com ``` Example 2: ``` af5134@borchmore.edu => a...
apps_data_3788
## Task You have to write three functions namely - `PNum, GPNum and SPNum` (JS, Coffee), `p_num, g_p_num and s_p_num` (Python and Ruby), `pNum, gpNum and spNum` (Java, C#), `p-num, gp-num and sp-num` (Clojure) - to check whether a given argument `n` is a Pentagonal, Generalized Pentagonal, or Square Pentagonal Number,...
apps_data_3789
You've just recently been hired to calculate scores for a Dart Board game! Scoring specifications: * 0 points - radius above 10 * 5 points - radius between 5 and 10 inclusive * 10 points - radius less than 5 **If all radii are less than 5, award 100 BONUS POINTS!** Write a function that accepts an array of radii (...
apps_data_3790
In this Kata, you will be given an array of arrays and your task will be to return the number of unique arrays that can be formed by picking exactly one element from each subarray. For example: `solve([[1,2],[4],[5,6]]) = 4`, because it results in only `4` possiblites. They are `[1,4,5],[1,4,6],[2,4,5],[2,4,6]`. ``...
apps_data_3791
# Task You are given a `moment` in time and space. What you must do is break it down into time and space, to determine if that moment is from the past, present or future. `Time` is the sum of characters that increase time (i.e. numbers in range ['1'..'9']. `Space` in the number of characters which do not increase...
apps_data_3792
# Task You know the slogan `p`, which the agitators have been chanting for quite a while now. Roka has heard this slogan a few times, but he missed almost all of them and grasped only their endings. You know the string `r` that Roka has heard. You need to determine what is the `minimal number` of times agitators r...
apps_data_3793
In this kata, you should calculate type of triangle with three given sides ``a``, ``b`` and ``c`` (given in any order). If all angles are less than ``90°``, this triangle is ``acute`` and function should return ``1``. If one angle is strictly ``90°``, this triangle is ``right`` and function should return ``2``. If o...
apps_data_3794
Given a list of integers, return the nth smallest integer in the list. **Only distinct elements should be considered** when calculating the answer. `n` will always be positive (`n > 0`) If the nth small integer doesn't exist, return `-1` (C++) / `None` (Python) / `nil` (Ruby) / `null` (JavaScript). Notes: * "indexing...
apps_data_3795
Create a combat function that takes the player's current health and the amount of damage recieved, and returns the player's new health. Health can't be less than 0. def combat(health, damage): return max(0, health-damage) def combat(health, damage): return max(health - damage, 0) def combat(health, damage): ...
apps_data_3796
It started as a discussion with a friend, who didn't fully grasp some way of setting defaults, but I thought the idea was cool enough for a beginner kata: binary `OR` each matching element of two given arrays (or lists, if you do it in Python; vectors in c++) of integers and give the resulting ORed array [starts to sou...
apps_data_3797
"The Shell Game" involves cups upturned on a playing surface, with a ball placed underneath one of them. The index of the cups are swapped around multiple times. After that the players will try to find which cup contains the ball. Your task is as follows. Given the cup that the ball starts under, and list of swaps, ...
apps_data_3798
# Task Pero has been into robotics recently, so he decided to make a robot that checks whether a deck of poker cards is complete. He’s already done a fair share of work - he wrote a programme that recognizes the suits of the cards. For simplicity’s sake, we can assume that all cards have a suit and a number. The s...
apps_data_3799
You've came to visit your grandma and she straight away found you a job - her Christmas tree needs decorating! She first shows you a tree with an identified number of branches, and then hands you a some baubles (or loads of them!). You know your grandma is a very particular person and she would like the baubles to be...