id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_3000
## Task Let's say we have a positive integer, `$n$`. You have to find the smallest possible positive integer that when multiplied by `$n$`, becomes a perfect power of integer `$k$`. A perfect power of `$k$` is any positive integer that can be represented as `$a^k$`. For example if `$k = 2$`, then `$36$` is a perfect p...
apps_data_3001
# Invalid Login - Bug Fixing #11 Oh NO! Timmy has moved divisions... but now he's in the field of security. Timmy, being the top coder he is, has allowed some bad code through. You must help Timmy and filter out any injected code! ## Task Your task is simple, search the password string for any injected code (Injecte...
apps_data_3002
## Task: You have to create a function `isPronic` to check whether the argument passed is a Pronic Number and return true if it is & false otherwise. ### Description: `Pronic Number` -A pronic number, oblong number, rectangular number or heteromecic number, is a number which is the product of two consecutive integers...
apps_data_3003
```if:python Create a function `args_count`, that returns the count of passed arguments ``` ```if:kotlin Create a function `argsCount`, that returns the count of passed arguments ``` ```if:ruby Create a method `args_count`, that returns the count of passed arguments ``` ```if:julia Create a method `argscount`, that ret...
apps_data_3004
It's Friday night, and Chuck is bored. He's already run 1,000 miles, stopping only to eat a family sized bag of Heatwave Doritos and a large fistful of M&Ms. He just can't stop thinking about kicking something! There is only one thing for it, Chuck heads down to his local MMA gym and immediately challenges every figh...
apps_data_3005
We have a set of consecutive numbers from ```1``` to ```n```. We want to count all the subsets that do not contain consecutive numbers. E.g. If our set ```S1``` is equal to ```[1,2,3,4,5]``` The subsets that fulfill these property are: ``` [1],[2],[3],[4],[5],[1,3],[1,4],[1,5],[2,4],[2,5],[3,5],[1,3,5] ``` A total of ...
apps_data_3006
Reducing Problems - Bug Fixing #8 Oh no! Timmy's reduce is causing problems, Timmy's goal is to calculate the two teams scores and return the winner but timmy has gotten confused and sometimes teams don't enter their scores, total the scores out of 3! Help timmy fix his program! Return true if team 1 wins or false if...
apps_data_3007
Let's say we have a number, `num`. Find the number of values of `n` such that: there exists `n` consecutive **positive** values that sum up to `num`. A positive number is `> 0`. `n` can also be 1. ```python #Examples num = 1 #1 return 1 num = 15 #15, (7, 8), (4, 5, 6), (1, 2, 3, 4, 5) return 4 num = 48 #48, (15, 16,...
apps_data_3008
Failed Sort - Bug Fixing #4 Oh no, Timmy's Sort doesn't seem to be working? Your task is to fix the sortArray function to sort all numbers in ascending order def sort_array(value): return "".join(sorted(value)) sort_array=lambda v: "".join(sorted(v)) def sort_array(value): return "".join(sorted(list(value)))...
apps_data_3009
In this Kata your task will be to return the count of pairs that have consecutive numbers as follows: ```Haskell pairs([1,2,5,8,-4,-3,7,6,5]) = 3 The pairs are selected as follows [(1,2),(5,8),(-4,-3),(7,6),5] --the first pair is (1,2) and the numbers in the pair are consecutive; Count = 1 --the second pair is (5,8) an...
apps_data_3010
Complete the solution so that it takes the object (JavaScript/CoffeeScript) or hash (ruby) passed in and generates a human readable string from its key/value pairs. The format should be "KEY = VALUE". Each key/value pair should be separated by a comma except for the last pair. **Example:** ```python solution({"a": 1...
apps_data_3011
# Task You have some people who are betting money, and they all start with the same amount of money (this number>0). Find out if the given end-state of amounts is possible after the betting is over and money is redistributed. # Input/Output - `[input]` integer array arr the proposed end-state showing final a...
apps_data_3012
In this Kata you need to write the method SharedBits that returns true if 2 integers share at least two '1' bits. For simplicity assume that all numbers are positive For example int seven = 7; //0111 int ten = 10; //1010 int fifteen = 15; //1111 SharedBits(seven, ten); //false SharedBits(seven, fifteen); //...
apps_data_3013
# Task Given an integer `n`, find the maximal number you can obtain by deleting exactly one digit of the given number. # Example For `n = 152`, the output should be `52`; For `n = 1001`, the output should be `101`. # Input/Output - `[input]` integer `n` Constraints: `10 ≤ n ≤ 1000000.` - `[output]` ...
apps_data_3014
Simple transposition is a basic and simple cryptography technique. We make 2 rows and put first a letter in the Row 1, the second in the Row 2, third in Row 1 and so on until the end. Then we put the text from Row 2 next to the Row 1 text and thats it. Complete the function that receives a string and encrypt it with t...
apps_data_3015
Given a credit card number we can determine who the issuer/vendor is with a few basic knowns. ```if:python Complete the function `get_issuer()` that will use the values shown below to determine the card issuer for a given card number. If the number cannot be matched then the function should return the string `Unknown`...
apps_data_3016
Check if given chord is minor or major. _____________________________________________________________ Rules: 1. Basic minor/major chord have three elements. 2. Chord is minor when interval between first and second element equals 3 and between second and third -> 4. 3. Chord is major when interval between first and ...
apps_data_3017
# Task Vanya gets bored one day and decides to enumerate a large pile of rocks. He first counts the rocks and finds out that he has `n` rocks in the pile, then he goes to the store to buy labels for enumeration. Each of the labels is a digit from 0 to 9 and each of the `n` rocks should be assigned a unique number ...
apps_data_3018
Kate likes to count words in text blocks. By words she means continuous sequences of English alphabetic characters (from a to z ). Here are examples: `Hello there, little user5453 374 ())$. I’d been using my sphere as a stool. Slow-moving target 839342 was hit by OMGd-63 or K4mp.` contains "words" `['Hello', 'there', ...
apps_data_3019
**This Kata is intended as a small challenge for my students** All Star Code Challenge #18 Create a function called that accepts 2 string arguments and returns an integer of the count of occurrences the 2nd argument is found in the first one. If no occurrences can be found, a count of 0 should be returned. Notes: *...
apps_data_3020
Kontti language is a finnish word play game. You add `-kontti` to the end of each word and then swap their characters until and including the first vowel ("aeiouy"); For example the word `tame` becomes `kome-tantti`; `fruity` becomes `koity-fruntti` and so on. If no vowel is present, the word stays the same. Write...
apps_data_3021
The queen can be moved any number of unoccupied squares in a straight line vertically, horizontally, or diagonally, thus combining the moves of the rook and bishop. The queen captures by occupying the square on which an enemy piece sits. (wikipedia: https://en.wikipedia.org/wiki/Queen_(chess)). ## Task: Write a functi...
apps_data_3022
In this kata, your job is to return the two distinct highest values in a list. If there're less than 2 unique values, return as many of them, as possible. The result should also be ordered from highest to lowest. Examples: ``` [4, 10, 10, 9] => [10, 9] [1, 1, 1] => [1] [] => [] ``` def two_highest(ls): re...
apps_data_3023
# Task "AL-AHLY" and "Zamalek" are the best teams in Egypt, but "AL-AHLY" always wins the matches between them. "Zamalek" managers want to know what is the best match they've played so far. The best match is the match they lost with the minimum goal difference. If there is more than one match with the same differen...
apps_data_3024
Make a program that filters a list of strings and returns a list with only your friends name in it. If a name has exactly 4 letters in it, you can be sure that it has to be a friend of yours! Otherwise, you can be sure he's not... Ex: Input = ["Ryan", "Kieran", "Jason", "Yous"], Output = ["Ryan", "Yous"] i.e. Note:...
apps_data_3025
Write a function that gets a sequence and value and returns `true/false` depending on whether the variable exists in a multidimentional sequence. Example: ``` locate(['a','b',['c','d',['e']]],'e'); // should return true locate(['a','b',['c','d',['e']]],'a'); // should return true locate(['a','b',['c','d',['e']]],'f');...
apps_data_3026
# Task **_Given_** a **_list of digits_**, *return the **_smallest number_** that could be formed from these digits, using the digits only once (ignore duplicates).* ___ # Notes: * Only **_positive integers_** *will be passed to the function (> 0 ), no negatives or zeros.* ___ # Input >> Output Examples ``` minVa...
apps_data_3027
Given a board of `NxN`, distributed with tiles labeled `0` to `N² - 1`(inclusive): A solved grid will have the tiles in order of label, left to right, top to bottom. Return `true` if the board state is currently solved, and `false` if the board state is unsolved. Input will always be a square 2d array. For example...
apps_data_3028
The factorial of a number, `n!`, is defined for whole numbers as the product of all integers from `1` to `n`. For example, `5!` is `5 * 4 * 3 * 2 * 1 = 120` Most factorial implementations use a recursive function to determine the value of `factorial(n)`. However, this blows up the stack for large values of `n` - mos...
apps_data_3029
> In information theory and computer science, the Levenshtein distance is a string metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is the minimum number of single-character edits (i.e. insertions, deletions or substitutions) required to change one word i...
apps_data_3030
Take an integer `n (n >= 0)` and a digit `d (0 <= d <= 9)` as an integer. Square all numbers `k (0 <= k <= n)` between 0 and n. Count the numbers of digits `d` used in the writing of all the `k**2`. Call `nb_dig` (or nbDig or ...) the function taking `n` and `d` as parameters and returning this count. #Examples: ``` ...
apps_data_3031
Your task is very simple. Just write a function `isAlphabetic(s)`, which takes an input string `s` in lowercase and returns `true`/`false` depending on whether the string is in alphabetical order or not. For example, `isAlphabetic('kata')` is False as 'a' comes after 'k', but `isAlphabetic('ant')` is True. Good luck ...
apps_data_3032
The objective of this Kata is to write a function that creates a dictionary of factors for a range of numbers. The key for each list in the dictionary should be the number. The list associated with each key should possess the factors for the number. If a number possesses no factors (only 1 and the number itself), the...
apps_data_3033
Task ======= Make a custom esolang interpreter for the language Tick. Tick is a descendant of [Ticker](https://www.codewars.com/kata/esolang-ticker) but also very different data and command-wise. Syntax/Info ======== Commands are given in character format. Non-command characters should be ignored. Tick has an potent...
apps_data_3034
# Task Your task is to write a function for calculating the score of a 10 pin bowling game. The input for the function is a list of pins knocked down per roll for one player. Output is the player's total score. # Rules ## General rules Rules of bowling in a nutshell: * A game consists of 10 frames. In each frame th...
apps_data_3035
In mathematics, a matrix (plural matrices) is a rectangular array of numbers. Matrices have many applications in programming, from performing transformations in 2D space to machine learning. One of the most useful operations to perform on matrices is matrix multiplication, which takes a pair of matrices and produces ...
apps_data_3036
# Task Consider the following algorithm for constructing 26 strings S(1) .. S(26): ``` S(1) = "a"; For i in [2, 3, ..., 26]: S(i) = S(i - 1) + character(i) + S(i - 1).``` For example: ``` S(1) = "a" S(2) = S(1) + "b" + S(1) = "a" + "b" + "a" = "aba" S(3) = S(2) + "c" + S(2) = "aba" + "c" +"aba" = "abacaba" ... S(26)...
apps_data_3037
# Task CodeBots decided to make a gift for CodeMaster's birthday. They got a pack of candies of various sizes from the store, but instead of giving the whole pack they are trying to make the biggest possible candy from them. On each turn it is possible: ``` to pick any two candies of the same size and merge them ...
apps_data_3038
In this Kata, you will be given a string and your task is to return the most valuable character. The value of a character is the difference between the index of its last occurrence and the index of its first occurrence. Return the character that has the highest value. If there is a tie, return the alphabetically lowest...
apps_data_3039
*This kata is inspired by [Project Euler Problem #387](https://projecteuler.net/problem=387)* --- A [Harshad number](https://en.wikipedia.org/wiki/Harshad_number) (or Niven number) is a number that is divisible by the sum of its digits. A *right truncatable Harshad number* is any Harshad number that, when recursively...
apps_data_3040
# Description "It's the end of trick-or-treating and we have a list/array representing how much candy each child in our group has made out with. We don't want the kids to start arguing, and using our parental intuition we know trouble is brewing as many of the children in the group have received different amounts of ca...
apps_data_3041
Create a function that takes any sentence and redistributes the spaces (and adds additional spaces if needed) so that each word starts with a vowel. The letters should all be in the same order but every vowel in the sentence should be the start of a new word. The first word in the new sentence may start without a vowel...
apps_data_3042
Calculate the trace of a square matrix. A square matrix has `n` rows and `n` columns, where `n` is any integer > 0. The entries of the matrix can contain any number of integers. The function should return the calculated trace of the matrix, or `nil/None` if the array is empty or not square; you can otherwise assume the...
apps_data_3043
Given some positive integers, I wish to print the integers such that all take up the same width by adding a minimum number of leading zeroes. No leading zeroes shall be added to the largest integer. For example, given `1, 23, 2, 17, 102`, I wish to print out these numbers as follows: ```python 001 023 002 017 102 ```...
apps_data_3044
In this Kata, you will be given a string and your task is to determine if that string can be a palindrome if we rotate one or more characters to the left. ```Haskell solve("4455") = true, because after 1 rotation, we get "5445" which is a palindrome solve("zazcbaabc") = true, because after 3 rotations, we get "abczazc...
apps_data_3045
Given 2 elevators (named "left" and "right") in a building with 3 floors (numbered `0` to `2`), write a function `elevator` accepting 3 arguments (in order): - `left` - The current floor of the left elevator - `right` - The current floor of the right elevator - `call` - The floor that called an elevator It should re...
apps_data_3046
Given a positive integer `n`, return first n dgits of Thue-Morse sequence, as a string (see examples). Thue-Morse sequence is a binary sequence with 0 as the first element. The rest of the sequece is obtained by adding the Boolean (binary) complement of a group obtained so far. ``` For example: 0 01 0110 01101001 an...
apps_data_3047
Write ```python function repeating_fractions(numerator, denominator) ``` that given two numbers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part has repeated digits, replace those digits with a single digit in parentheses. For example: ```python re...
apps_data_3048
Write function alternateCase which switch every letter in string from upper to lower and from lower to upper. E.g: Hello World -> hELLO wORLD def alternateCase(s): return s.swapcase() alternateCase = str.swapcase def alternateCase(s): return ''.join(c.swapcase() for c in s) def alternateCase(s): ''' Sal...
apps_data_3049
Write a function that replaces 'two', 'too' and 'to' with the number '2'. Even if the sound is found mid word (like in octopus) or not in lowercase grandma still thinks that should be replaced with a 2. Bless her. ```text 'I love to text' becomes 'I love 2 text' 'see you tomorrow' becomes 'see you 2morrow' 'look at th...
apps_data_3050
Write a function called `LCS` that accepts two sequences and returns the longest subsequence common to the passed in sequences. ### Subsequence A subsequence is different from a substring. The terms of a subsequence need not be consecutive terms of the original sequence. ### Example subsequence Subsequences of `"abc"...
apps_data_3051
The idea for this Kata came from 9gag today.[here](http://9gag.com/gag/amrb4r9) [screen]:("http://img-9gag-fun.9cache.com/photo/amrb4r9_700b.jpg") You'll have to translate a string to Pilot's alphabet (NATO phonetic alphabet) [wiki](https://en.wikipedia.org/wiki/NATO_phonetic_alphabet). Like this: **Input:** `If, ...
apps_data_3052
### Description: Remove all exclamation marks from sentence except at the end. ### Examples ``` remove("Hi!") == "Hi!" remove("Hi!!!") == "Hi!!!" remove("!Hi") == "Hi" remove("!Hi!") == "Hi!" remove("Hi! Hi!") == "Hi Hi!" remove("Hi") == "Hi" ``` def remove(s): return s.replace('!', '')+ '!'*(len(s)- len(s.rst...
apps_data_3053
Create a function `close_compare` that accepts 3 parameters: `a`, `b`, and an optional `margin`. The function should return whether `a` is lower than, close to, or higher than `b`. `a` is "close to" `b` if `margin` is higher than or equal to the difference between `a` and `b`. When `a` is lower than `b`, return `-1`. ...
apps_data_3054
A [sequence or a series](http://world.mathigon.org/Sequences), in mathematics, is a string of objects, like numbers, that follow a particular pattern. The individual elements in a sequence are called terms. A simple example is `3, 6, 9, 12, 15, 18, 21, ...`, where the pattern is: _"add 3 to the previous term"_. In thi...
apps_data_3055
Create a function that takes 2 positive integers in form of a string as an input, and outputs the sum (also as a string): If either input is an empty string, consider it as zero. def sum_str(a, b): return str(int(a or 0) + int(b or 0)) def sum_str(a, b): return str(int('0' + a) + int('0' + b)) def sum_str(*...
apps_data_3056
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are: 2332 110011 54322345 You'll be given 2 numbers as arguments: ```(num,s)```. Write a function which returns an array of ```s``` number of numerical palindromes tha...
apps_data_3057
A **bouncy number** is a positive integer whose digits neither increase nor decrease. For example, `1235` is an increasing number, `5321` is a decreasing number, and `2351` is a bouncy number. By definition, all numbers under `100` are non-bouncy, and `101` is the first bouncy number. To complete this kata, you must wr...
apps_data_3058
In recreational mathematics, a magic square is an arrangement of distinct numbers (i.e., each number is used once), usually integers, in a square grid, where the numbers in each row, and in each column, and the numbers in the main and secondary diagonals, all add up to the same number, called the "magic constant." For...
apps_data_3059
You have an award-winning garden and everyday the plants need exactly 40mm of water. You created a great piece of JavaScript to calculate the amount of water your plants will need when you have taken into consideration the amount of rain water that is forecast for the day. Your jealous neighbour hacked your computer an...
apps_data_3060
In the board game Talisman, when two players enter combat the outcome is decided by a combat score, equal to the players power plus any modifiers plus the roll of a standard 1-6 dice. The player with the highest combat score wins and the opposing player loses a life. In the case of a tie combat ends with neither player...
apps_data_3061
Complete the function to find the count of the most frequent item of an array. You can assume that input is an array of integers. For an empty array return `0` ## Example ```python input array: [3, -1, -1, -1, 2, 3, -1, 3, -1, 2, 4, 9, 3] ouptut: 5 ``` The most frequent number in the array is `-1` and it occurs `5` t...
apps_data_3062
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are: 2332 110011 54322345 For a given number `num`, write a function to test if it's a numerical palindrome or not and return a boolean (true if it is and false if ...
apps_data_3063
Story Jumbo Juice makes a fresh juice out of fruits of your choice.Jumbo Juice charges $5 for regular fruits and $7 for special ones. Regular fruits are Banana, Orange, Apple, Lemon and Grapes. Special ones are Avocado, Strawberry and Mango. Others fruits that are not listed are also available upon request. Those extra...
apps_data_3064
Transpose means is to interchange rows and columns of a two-dimensional array matrix. [A^(T)]ij=[A]ji ie: Formally, the i th row, j th column element of AT is the j th row, i th column element of A: Example : ``` [[1,2,3],[4,5,6]].transpose() //should return [[1,4],[2,5],[3,6]] ``` Write a prototype transpose to...
apps_data_3065
We like parsed SQL or PL/SQL blocks... You need to write function that return list of literals indices from source block, excluding "in" comments, OR return empty list if no literals found. input: some fragment of sql or pl/sql code output: list of literals indices [(start, end), ...] OR empty list Sample: ``` get_...
apps_data_3066
In this Kata, you will be given a mathematical string and your task will be to remove all braces as follows: ```Haskell solve("x-(y+z)") = "x-y-z" solve("x-(y-z)") = "x-y+z" solve("u-(v-w-(x+y))-z") = "u-v+w+x+y-z" solve("x-(-y-z)") = "x+y+z" ``` There are no spaces in the expression. Only two operators are given: `"...
apps_data_3067
Bob needs a fast way to calculate the volume of a cuboid with three values: `length`, `width` and the `height` of the cuboid. Write a function to help Bob with this calculation. ```if:shell In bash the script is ran with the following 3 arguments: `length` `width` `height` ``` def get_volume_of_cuboid(length, width, ...
apps_data_3068
You need to play around with the provided string (s). Move consonants forward 9 places through the alphabet. If they pass 'z', start again at 'a'. Move vowels back 5 places through the alphabet. If they pass 'a', start again at 'z'. For our Polish friends this kata does not count 'y' as a vowel. Exceptions: If the ...
apps_data_3069
Your start-up's BA has told marketing that your website has a large audience in Scandinavia and surrounding countries. Marketing thinks it would be great to welcome visitors to the site in their own language. Luckily you already use an API that detects the user's location, so this is an easy win. ### The Task - Think...
apps_data_3070
Given a list of integers values, your job is to return the sum of the values; however, if the same integer value appears multiple times in the list, you can only count it once in your sum. For example: ```python [ 1, 2, 3] ==> 6 [ 1, 3, 8, 1, 8] ==> 12 [ -1, -1, 5, 2, -7] ==> -1 [] ==> None ``` Good Luck! def uni...
apps_data_3071
Define a function that takes in two non-negative integers `$a$` and `$b$` and returns the last decimal digit of `$a^b$`. Note that `$a$` and `$b$` may be very large! For example, the last decimal digit of `$9^7$` is `$9$`, since `$9^7 = 4782969$`. The last decimal digit of `$({2^{200}})^{2^{300}}$`, which has over `$...
apps_data_3072
Well, those numbers were right and we're going to feed their ego. Write a function, isNarcissistic, that takes in any amount of numbers and returns true if all the numbers are narcissistic. Return false for invalid arguments (numbers passed in as strings are ok). For more information about narcissistic numbers (and b...
apps_data_3073
An `non decreasing` number is one containing no two consecutive digits (left to right), whose the first is higer than the second. For example, 1235 is an non decreasing number, 1229 is too, but 123429 isn't. Write a function that finds the number of non decreasing numbers up to `10**N` (exclusive) where N is the input...
apps_data_3074
### Task Each day a plant is growing by `upSpeed` meters. Each night that plant's height decreases by `downSpeed` meters due to the lack of sun heat. Initially, plant is 0 meters tall. We plant the seed at the beginning of a day. We want to know when the height of the plant will reach a certain level. ### Example F...
apps_data_3075
Array inversion indicates how far the array is from being sorted. Inversions are pairs of elements in array that are out of order. ## Examples ``` [1, 2, 3, 4] => 0 inversions [1, 3, 2, 4] => 1 inversion: 2 and 3 [4, 1, 2, 3] => 3 inversions: 4 and 1, 4 and 2, 4 and 3 [4, 3, 2, 1] => 6 inversions: 4 and 3, 4...
apps_data_3076
In this Kata, you will be given directions and your task will be to find your way back. ```Perl solve(["Begin on Road A","Right on Road B","Right on Road C","Left on Road D"]) = ['Begin on Road D', 'Right on Road C', 'Left on Road B', 'Left on Road A'] solve(['Begin on Lua Pkwy', 'Right on Sixth Alley', 'Right on 1st ...
apps_data_3077
##Task: You have to write a function **pattern** which creates the following pattern upto n number of rows. *If the Argument is 0 or a Negative Integer then it should return "" i.e. empty string.* ##Examples: pattern(4): 1234 234 34 4 pattern(6): 123456 23456 3456 456 5...
apps_data_3078
# Task Consider an array of integers `a`. Let `min(a)` be its minimal element, and let `avg(a)` be its mean. Define the center of the array `a` as array `b` such that: ``` - b is formed from a by erasing some of its elements. - For each i, |b[i] - avg(a)| < min(a). - b has the maximum number of elements among all the...
apps_data_3079
Given a certain integer ```n```, we need a function ```big_primefac_div()```, that give an array with the highest prime factor and the highest divisor (not equal to n). Let's see some cases: ```python big_primefac_div(100) == [5, 50] big_primefac_div(1969) == [179, 179] ``` If n is a prime number the function will out...
apps_data_3080
Don Drumphet lives in a nice neighborhood, but one of his neighbors has started to let his house go. Don Drumphet wants to build a wall between his house and his neighbor’s, and is trying to get the neighborhood association to pay for it. He begins to solicit his neighbors to petition to get the association to build ...
apps_data_3081
Following on from [Part 1](http://www.codewars.com/kata/filling-an-array-part-1/), part 2 looks at some more complicated array contents. So let's try filling an array with... ## ...square numbers The numbers from `1` to `n*n` ## ...a range of numbers A range of numbers starting from `start` and increasing by `step` ...
apps_data_3082
In this kata you will create a function to check a non-negative input to see if it is a prime number. The function will take in a number and will return True if it is a prime number and False if it is not. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. ### Ex...
apps_data_3083
Most of this problem is by the original author of [the harder kata](https://www.codewars.com/kata/556206664efbe6376700005c), I just made it simpler. I read a book recently, titled "Things to Make and Do in the Fourth Dimension" by comedian and mathematician Matt Parker ( [Youtube](https://www.youtube.com/user/standupm...
apps_data_3084
Your task is to write a function that takes two or more objects and returns a new object which combines all the input objects. All input object properties will have only numeric values. Objects are combined together so that the values of matching keys are added together. An example: ```python objA = { 'a': 10, 'b':...
apps_data_3085
The AKS algorithm for testing whether a number is prime is a polynomial-time test based on the following theorem: A number p is prime if and only if all the coefficients of the polynomial expansion of `(x − 1)^p − (x^p − 1)` are divisible by `p`. For example, trying `p = 3`: (x − 1)^3 − (x^3 − 1) = (x^3 − 3x^2...
apps_data_3086
#Unflatten a list (Easy) There are several katas like "Flatten a list". These katas are done by so many warriors, that the count of available list to flattin goes down! So you have to build a method, that creates new arrays, that can be flattened! #Shorter: You have to unflatten a list/an array. You get an array of...
apps_data_3087
You will be given a string and you task is to check if it is possible to convert that string into a palindrome by removing a single character. If the string is already a palindrome, return `"OK"`. If it is not, and we can convert it to a palindrome by removing one character, then return `"remove one"`, otherwise return...
apps_data_3088
An NBA game runs 48 minutes (Four 12 minute quarters). Players do not typically play the full game, subbing in and out as necessary. Your job is to extrapolate a player's points per game if they played the full 48 minutes. Write a function that takes two arguments, ppg (points per game) and mpg (minutes per game) and ...
apps_data_3089
Given a number, return a string with dash``` '-' ```marks before and after each odd integer, but do not begin or end the string with a dash mark. Ex: import re def dashatize(num): try: return ''.join(['-'+i+'-' if int(i)%2 else i for i in str(abs(num))]).replace('--','-').strip('-') except: r...
apps_data_3090
Find the 2nd largest integer in array If the array has no 2nd largest integer then return nil. Reject all non integers elements and then find the 2nd largest integer in array find_2nd_largest([1,2,3]) => 2 find_2nd_largest([1,1,1,1,1]) => nil because all elements are same. Largest no. is 1. and there is no 2nd larges...
apps_data_3091
The local transport authority is organizing an online picture contest. Participants must take pictures of transport means in an original way, and then post the picture on Instagram using a specific ```hashtag```. The local transport authority needs your help. They want you to take out the ```hashtag``` from the posted...
apps_data_3092
You have to rebuild a string from an enumerated list. For this task, you have to check if input is correct beforehand. * Input must be a list of tuples * Each tuple has two elements. * Second element is an alphanumeric character. * First element is the index of this character into the reconstructed string. * Indexes s...
apps_data_3093
Write a function `insertDash(num)`/`InsertDash(int num)` that will insert dashes ('-') between each two odd numbers in num. For example: if num is 454793 the output should be 4547-9-3. Don't count zero as an odd number. Note that the number will always be non-negative (>= 0). import re def insert_dash(num): #you...
apps_data_3094
Sum all the numbers of the array (in F# and Haskell you get a list) except the highest and the lowest element (the value, not the index!). (The highest/lowest element is respectively only one element at each edge, even if there are more than one with the same value!) Example: ``` { 6, 2, 1, 8, 10 } => 16 { 1, 1, 11, 2,...
apps_data_3095
You like the way the Python `+` operator easily handles adding different numeric types, but you need a tool to do that kind of addition without killing your program with a `TypeError` exception whenever you accidentally try adding incompatible types like strings and lists to numbers. You decide to write a function `my...
apps_data_3096
This problem takes its name by arguably the most important event in the life of the ancient historian Josephus: according to his tale, he and his 40 soldiers were trapped in a cave by the Romans during a siege. Refusing to surrender to the enemy, they instead opted for mass suicide, with a twist: **they formed a circl...
apps_data_3097
Comprised of a team of five incredibly brilliant women, "The ladies of ENIAC" were the first “computors” working at the University of Pennsylvania’s Moore School of Engineering (1945). Through their contributions, we gained the first software application and the first programming classes! The ladies of ENIAC were induc...
apps_data_3098
The `depth` of an integer `n` is defined to be how many multiples of `n` it is necessary to compute before all `10` digits have appeared at least once in some multiple. example: ``` let see n=42 Multiple value digits comment 42*1 42 2,4 42*2 84 8 ...
apps_data_3099
Based on [this kata, Connect Four.](https://www.codewars.com/kata/connect-four-1) In this kata we play a modified game of connect four. It's connect X, and there can be multiple players. Write the function ```whoIsWinner(moves,connect,size)```. ```2 <= connect <= 10``` ```2 <= size <= 52``` Each column is identifi...