id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_4500
You get any card as an argument. Your task is to return a suit of this card. Our deck (is preloaded): ```python DECK = ['2S','3S','4S','5S','6S','7S','8S','9S','10S','JS','QS','KS','AS', '2D','3D','4D','5D','6D','7D','8D','9D','10D','JD','QD','KD','AD', '2H','3H','4H','5H','6H','7H','8H','9H','10H','JH...
apps_data_4501
You are given a string of words (x), for each word within the string you need to turn the word 'inside out'. By this I mean the internal letters will move out, and the external letters move toward the centre. If the word is even length, all letters will move. If the length is odd, you are expected to leave the 'middl...
apps_data_4502
Well met with Fibonacci bigger brother, AKA Tribonacci. As the name may already reveal, it works basically like a Fibonacci, but summing the last 3 (instead of 2) numbers of the sequence to generate the next. And, worse part of it, regrettably I won't get to hear non-native Italian speakers trying to pronounce it :( ...
apps_data_4503
When you want to get the square of a binomial of two variables x and y, you will have: `$(x+y)^2 = x^2 + 2xy + y ^2$` And the cube: `$(x+y)^3 = x^3 + 3x^2y + 3xy^2 +y^3$` It is known from many centuries ago that for an exponent n, the result of a binomial x + y raised to the n-th power is: Or using the sumation no...
apps_data_4504
Share price =========== You spent all your saved money to buy some shares. You bought it for `invested`, and want to know how much it's worth, but all the info you can quickly get are just the change the shares price made in percentages. Your task: ---------- Write the function `sharePrice()` that calculates, and re...
apps_data_4505
Create an identity matrix of the specified size( >= 0). Some examples: ``` (1) => [[1]] (2) => [ [1,0], [0,1] ] [ [1,0,0,0,0], [0,1,0,0,0], (5) => [0,0,1,0,0], [0,0,0,1,0], [0,0,0,0,1] ] ``` def get_matrix(n): return [[1 if i==j else 0 for i in range(n)] for ...
apps_data_4506
In your class, you have started lessons about geometric progression. Since you are also a programmer, you have decided to write a function that will print first `n` elements of the sequence with the given constant `r` and first element `a`. Result should be separated by comma and space. ### Example ```python geometr...
apps_data_4507
Create a function that accepts 3 inputs, a string, a starting location, and a length. The function needs to simulate the string endlessly repeating in both directions and return a substring beginning at the starting location and continues for length. Example: ```python endless_string('xyz', -23, 6) == 'yzxyzx' ``` To...
apps_data_4508
A *Vampire number* is a positive integer `z` with a factorization `x * y = z` such that - `x` and `y` have the same number of digits and - the multiset of digits of `z` is equal to the multiset of digits of `x` and `y`. - Additionally, to avoid trivialities, `x` and `y` may not both end with `0`. In this case, `x` an...
apps_data_4509
Your task is to validate rhythm with a meter. _________________________________________________ Rules: 1. Rhythmic division requires that in one whole note (1) there are two half notes (2) or four quarter notes (4) or eight eighth notes (8). Examples: 1 = 2 + 2, 1 = 4 + 4 + 4 + 4 ... Note that: 2 = 4 + 4, 4 = 8 + 8...
apps_data_4510
Complete the function/method so that it takes CamelCase string and returns the string in snake_case notation. Lowercase characters can be numbers. If method gets number, it should return string. Examples: ``` javascript // returns test_controller toUnderscore('TestController'); // returns movies_and_books toUndersc...
apps_data_4511
Write a function that will check whether the permutation of an input string is a palindrome. Bonus points for a solution that is efficient and/or that uses _only_ built-in language functions. Deem yourself **brilliant** if you can come up with a version that does not use _any_ function whatsoever. # Example `madam...
apps_data_4512
Consider the following series: `0,1,2,3,4,5,6,7,8,9,10,22,11,20,13,24...`There is nothing special between numbers `0` and `10`. Let's start with the number `10` and derive the sequence. `10` has digits `1` and `0`. The next possible number that does not have a `1` or a `0` is `22`. All other numbers between `10` and...
apps_data_4513
You will be given an array of numbers. For each number in the array you will need to create an object. The object key will be the number, as a string. The value will be the corresponding character code, as a string. Return an array of the resulting objects. All inputs will be arrays of numbers. All character codes...
apps_data_4514
In this Kata you must convert integers numbers from and to a negative-base binary system. Negative-base systems can accommodate all the same numbers as standard place-value systems, but both positive and negative numbers are represented without the use of a minus sign (or, in computer representation, a sign bit); this...
apps_data_4515
Your task is to find the number couple with the greatest difference from a given array of number-couples. All number couples will be given as strings and all numbers in them will be positive integers. For instance: ['56-23','1-100']; in this case, you should identify '1-100' as the number couple with the greatest ...
apps_data_4516
Make a program that takes a value (x) and returns "Bang" if the number is divisible by 3, "Boom" if it is divisible by 5, "BangBoom" if it divisible by 3 and 5, and "Miss" if it isn't divisible by any of them. Note: Your program should only return one value Ex: Input: 105 --> Output: "BangBoom" Ex: Input: 9 --> Output...
apps_data_4517
Complete the function that takes a string as an input, and return a list of all the unpaired characters (i.e. they show up an odd number of times in the string), in the order they were encountered as an array. In case of multiple appearances to choose from, take the last occurence of the unpaired character. **Notes:...
apps_data_4518
Write a function that returns the index of the first occurence of the word "Wally". "Wally" must not be part of another word, but it can be directly followed by a punctuation mark. If no such "Wally" exists, return -1. Examples: "Wally" => 0 "Where's Wally" => 8 "Where's Waldo" => -1 "DWally Wallyd .Wally" => -...
apps_data_4519
# Task **_Given_** *a number* , **_Return_** **_The Maximum number _** *could be formed from the digits of the number given* . ___ # Notes * **_Only Natural numbers_** *passed to the function , numbers Contain digits [0:9] inclusive* * **_Digit Duplications_** *could occur* , So also **_consider it when formin...
apps_data_4520
Rick wants a faster way to get the product of the largest pair in an array. Your task is to create a performant solution to find the product of the largest two integers in a unique array of positive numbers. All inputs will be valid. Passing [2, 6, 3] should return 18, the product of [6, 3]. ```Disclaimer: Mr. Roll wi...
apps_data_4521
Vasya wants to climb up a stair of certain amount of steps (Input parameter 1). There are 2 simple rules that he has to stick to. 1. Vasya can climb 1 or 2 steps at each move. 2. Vasya wants the number of moves to be a multiple of a certain integer. (Input parameter 2). ### Task: What is the `MINIMAL` number of moves...
apps_data_4522
**DESCRIPTION:** Your strict math teacher is teaching you about right triangles, and the Pythagorean Theorem --> a^2 + b^2 = c^2 whereas a and b are the legs of the right triangle and c is the hypotenuse of the right triangle. On the test however, the question asks: What are the possible integer lengths for the othe...
apps_data_4523
In this Kata, you will be given an integer `n` and your task will be to return `the largest integer that is <= n and has the highest digit sum`. For example: ``` solve(100) = 99. Digit Sum for 99 = 9 + 9 = 18. No other number <= 100 has a higher digit sum. solve(10) = 9 solve(48) = 48. Note that 39 is also an option, ...
apps_data_4524
A number is simply made up of digits. The number 1256 is made up of the digits 1, 2, 5, and 6. For 1256 there are 24 distinct permutations of the digits: 1256, 1265, 1625, 1652, 1562, 1526, 2156, 2165, 2615, 2651, 2561, 2516, 5126, 5162, 5216, 5261, 5621, 5612, 6125, 6152, 6251, 6215, 6521, 6512. Your goal ...
apps_data_4525
Given the number pledged for a year, current value and name of the month, return string that gives information about the challenge status: - ahead of schedule - behind schedule - on track - challenge is completed Examples: `(12, 1, "February")` - should return `"You are on track."` `(12, 1, "March")` - should retur...
apps_data_4526
*SCHEDULE YOUR DA(RRA)Y* The best way to have a productive day is to plan out your work schedule. Given the following three inputs, please create an an array of time alloted to work, broken up with time alloted with breaks: Input 1: Hours - Number of hours available to you to get your work done! Inpu...
apps_data_4527
Steve and Josh are bored and want to play something. They don't want to think too much, so they come up with a really simple game. Write a function called winner and figure out who is going to win. They are dealt the same number of cards. They both flip the card on the top of their deck. Whoever has a card with higher...
apps_data_4528
## Your task You are given a dictionary/hash/object containing some languages and your test results in the given languages. Return the list of languages where your test score is at least `60`, in descending order of the results. Note: the scores will always be unique (so no duplicate values) ## Examples ```python {...
apps_data_4529
Truncate the given string (first argument) if it is longer than the given maximum length (second argument). Return the truncated string with a `"..."` ending. Note that inserting the three dots to the end will add to the string length. However, if the given maximum string length num is less than or equal to 3, then t...
apps_data_4530
Write a function `consonantCount`, `consonant_count` or `ConsonantCount` that takes a string of English-language text and returns the number of consonants in the string. Consonants are all letters used to write English excluding the vowels `a, e, i, o, u`. def consonant_count(str): return sum(1 for c in str if c....
apps_data_4531
Convert integers to binary as simple as that. You would be given an integer as a argument and you have to return its binary form. To get an idea about how to convert a decimal number into a binary number, visit here. **Notes**: negative numbers should be handled as two's complement; assume all numbers are integers sto...
apps_data_4532
Basic regex tasks. Write a function that takes in a numeric code of any length. The function should check if the code begins with 1, 2, or 3 and return `true` if so. Return `false` otherwise. You can assume the input will always be a number. def validate_code(code): return str(code).startswith(('1', '2', '3')) ...
apps_data_4533
The image shows how we can obtain the Harmonic Conjugated Point of three aligned points A, B, C. - We choose any point L, that is not in the line with A, B and C. We form the triangle ABL - Then we draw a line from point C that intersects the sides of this triangle at points M and N respectively. - We draw the diago...
apps_data_4534
We have the number ```12385```. We want to know the value of the closest cube but higher than 12385. The answer will be ```13824```. Now, another case. We have the number ```1245678```. We want to know the 5th power, closest and higher than that number. The value will be ```1419857```. We need a function ```find_next...
apps_data_4535
The goal of this Kata is to remind/show you, how Z-algorithm works and test your implementation. For a string str[0..n-1], Z array is of same length as string. An element Z[i] of Z array stores length of the longest substring starting from str[i] which is also a prefix of str[0..n-1]. The first entry of Z array is mea...
apps_data_4536
Create a function that takes an input String and returns a String, where all the uppercase words of the input String are in front and all the lowercase words at the end. The order of the uppercase and lowercase words should be the order in which they occur. If a word starts with a number or special character, skip the...
apps_data_4537
Gray code is a form of binary encoding where transitions between consecutive numbers differ by only one bit. This is a useful encoding for reducing hardware data hazards with values that change rapidly and/or connect to slower hardware as inputs. It is also useful for generating inputs for Karnaugh maps. Here is an ex...
apps_data_4538
You are going to be given a string. Your job is to return that string in a certain order that I will explain below: Let's say you start with this: `012345` The first thing you do is reverse it:`543210` Then you will take the string from the 1st position and reverse it again:`501234` Then you will take the string ...
apps_data_4539
You are trying to cross a river by jumping along stones. Every time you land on a stone, you hop forwards by the value of that stone. If you skip *over* a stone then its value doesn't affect you in any way. Eg: ``` x--x-----x--> [1][2][5][1] ``` Of course, crossing from the other side might give you a different ans...
apps_data_4540
Check if given numbers are prime numbers. If number N is prime ```return "Probable Prime"``` else ``` return "Composite"```. HINT: Upper bount is really big so you should use an efficient algorithm. Input   1 < N ≤ 10^(100) Example   prime_or_composite(2) # should return Probable Prime   prime_or_composite(200) #...
apps_data_4541
# Task You are given an array of integers `a` and a non-negative number of operations `k`, applied to the array. Each operation consists of two parts: ``` find the maximum element value of the array; replace each element a[i] with (maximum element value - a[i]).``` How will the array look like after `k` such operation...
apps_data_4542
Let’s get to know our hero: Agent #134 - Mr. Slayer. He was sent by his CSV agency to Ancient Rome in order to resolve some important national issues. However, something incredible has happened - the enemies have taken Julius Caesar as a prisoner!!! Caesar, not a simple man as you know, managed to send cryptic messag...
apps_data_4543
Why would we want to stop to only 50 shades of grey? Let's see to how many we can go. Write a function that takes a number n as a parameter and return an array containing n shades of grey in hexadecimal code (`#aaaaaa` for example). The array should be sorted in ascending order starting with `#010101`, `#020202`, etc...
apps_data_4544
# Task Consider the following operation: We take a positive integer `n` and replace it with the sum of its `prime factors` (if a prime number is presented multiple times in the factorization of `n`, then it's counted the same number of times in the sum). This operation is applied sequentially first to the given...
apps_data_4545
Create your own mechanical dartboard that gives back your score based on the coordinates of your dart. Task: Use the scoring rules for a standard dartboard: Finish method: ```python def get_score(x,y): ``` The coordinates are `(x, y)` are always relative to the center of the board (0, 0). The unit is millimeters....
apps_data_4546
Mothers arranged a dance party for the children in school. At that party, there are only mothers and their children. All are having great fun on the dance floor when suddenly all the lights went out. It's a dark night and no one can see each other. But you were flying nearby and you can see in the dark and have ability...
apps_data_4547
Create a __moreZeros__ function which will __receive a string__ for input, and __return an array__ (or null terminated string in C) containing only the characters from that string whose __binary representation of its ASCII value__ consists of _more zeros than ones_. You should __remove any duplicate characters__, kee...
apps_data_4548
## Sum Even Fibonacci Numbers * Write a func named SumEvenFibonacci that takes a parameter of type int and returns a value of type int * Generate all of the Fibonacci numbers starting with 1 and 2 and ending on the highest number before exceeding the parameter's value #### Each new number in the Fibonacci sequence...
apps_data_4549
# Your task Oh no... more lemmings!! And in Lemmings Planet a huge battle is being fought between the two great rival races: the green lemmings and the blue lemmings. Everybody was now assigned to battle and they will fight until one of the races completely dissapears: the Deadly War has begun! Every single lemming ha...
apps_data_4550
Get n seconds before the target time. See Example Test Cases about the format. from datetime import * def seconds_ago(s,n): return str(datetime.strptime(s, '%Y-%m-%d %H:%M:%S') - timedelta(seconds=n)) from datetime import datetime,timedelta def seconds_ago(s,n): t = datetime.strptime(s,'%Y-%m-%d %H:%M:%S')-...
apps_data_4551
We have a matrix of integers with m rows and n columns. We want to calculate the total sum for the matrix: As you can see, the name "alternating sum" of the title is due to the sign of the terms that changes from one term to its contiguous one and so on. Let's see an example: ``` matrix = [[1, 2, 3], [-3, -2, 1]...
apps_data_4552
You are given an array of unique numbers. The numbers represent points. The higher the number the higher the points. In the array [1,3,2] 3 is the highest point value so it gets 1st place. 2 is the second highest so it gets second place. 1 is the 3rd highest so it gets 3rd place. Your task is to return an array giv...
apps_data_4553
Simple, given a string of words, return the length of the shortest word(s). String will never be empty and you do not need to account for different data types. def find_short(s): return min(len(x) for x in s.split()) def find_short(s): return len(min(s.split(' '), key=len)) def find_short(s): return min...
apps_data_4554
# Letterss of Natac In a game I just made up that doesn’t have anything to do with any other game that you may or may not have played, you collect resources on each turn and then use those resources to build things like roads, settlements and cities. If you would like to try other kata about this game, they can be foun...
apps_data_4555
# Do names have colors? *Now they do.* Make a function that takes in a name (Any string two chars or longer really, but the name is the idea) and use the ascii values of it's substrings to produce the hex value of its color! Here is how it's going to work: * The first two hexadecimal digits are the *SUM* of the valu...
apps_data_4556
Given a string of integers, count how many times that integer repeats itself, then return a string showing the count and the integer. Example: `countMe('1123')` (`count_me` in Ruby) - Here 1 comes twice so `` will be `"21"` - then 2 comes once so `` will be `"12"` - then 3 comes once so `` will be `"13"` hence outp...
apps_data_4557
# Scenario **_Several people_** are standing in *a row divided into two teams*. The **_first person_** goes into **_team 1_**, **_the second_** goes into **_team 2_**, **_the third_** goes into **_team 1_**, and so on. ___ # Task **_Given_** *an array of positive integers (the weights of the people)*, **_return_** ...
apps_data_4558
# Task You are a lifelong fan of your local football club, and proud to say you rarely miss a game. Even though you're a superfan, you still hate boring games. Luckily, boring games often end in a draw, at which point the winner is determined by a penalty shoot-out, which brings some excitement to the viewing experienc...
apps_data_4559
The [Ones' Complement](https://en.wikipedia.org/wiki/Ones%27_complement) of a binary number is the number obtained by swapping all the 0s for 1s and all the 1s for 0s. For example: ``` onesComplement(1001) = 0110 onesComplement(1001) = 0110 ``` For any given binary number,formatted as a string, return the Ones' Compl...
apps_data_4560
Mr. Khalkhoul, an amazing teacher, likes to answer questions sent by his students via e-mail, but he often doesn't have the time to answer all of them. In this kata you will help him by making a program that finds some of the answers. You are given a `question` which is a string containing the question and some `infor...
apps_data_4561
Consider the string `"adfa"` and the following rules: ```Pearl a) each character MUST be changed either to the one before or the one after in alphabet. b) "a" can only be changed to "b" and "z" to "y". ``` From our string, we get: ```Pearl "adfa" -> ["begb","beeb","bcgb","bceb"] Another example: "bd" -> ["ae","ac","...
apps_data_4562
Flash has invited his nemesis The Turtle (He actually was a real villain! ) to play his favourite card game, SNAP. In this game a 52 card deck is dealt out so both Flash and the Turtle get 26 random cards. Each players cards will be represented by an array like below Flash’s pile: ```[ 'A', '5', 'Q', 'Q', '6', '2', ...
apps_data_4563
Having two standards for a keypad layout is inconvenient! Computer keypad's layout: Cell phone keypad's layout: Solve the horror of unstandartized keypads by providing a function that converts computer input to a number as if it was typed by a phone. Example: "789" -> "123" Notes: You get a string wit...
apps_data_4564
Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number. Example: ```python create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) # => returns "(123) 456-7890" ``` ```f# createPhoneNumber [1; 2; 3; 4; 5; 6; 7; 8; 9; 0] // => returns "...
apps_data_4565
The code provided is supposed replace all the dots `.` in the specified String `str` with dashes `-` But it's not working properly. # Task Fix the bug so we can all go home early. # Notes String `str` will never be null. def replace_dots(string): return string.replace('.', '-') import re def replace_dots(str...
apps_data_4566
You need count how many valleys you will pass. Start is always from zero level. Every time you go down below 0 level counts as an entry of a valley, and as you go up to 0 level from valley counts as an exit of a valley. One passed valley is equal one entry and one exit of a valley. ``` s='FUFFDDFDUDFUFUF' U=UP F=FOR...
apps_data_4567
Apparently "Put A Pillow On Your Fridge Day is celebrated on the 29th of May each year, in Europe and the U.S. The day is all about prosperity, good fortune, and having bit of fun along the way." All seems very weird to me. Nevertheless, you will be given an array of two strings (s). First find out if the first strin...
apps_data_4568
*This is the advanced version of the [Minimum and Maximum Product of k Elements](https://www.codewars.com/kata/minimum-and-maximum-product-of-k-elements/) kata.* --- Given a list of **integers** and a positive integer `k` (> 0), find the minimum and maximum possible product of `k` elements taken from the list. If y...
apps_data_4569
Given a sequence of items and a specific item in that sequence, return the item immediately following the item specified. If the item occurs more than once in a sequence, return the item after the first occurence. This should work for a sequence of any type. When the item isn't present or nothing follows it, the funct...
apps_data_4570
Assume `"#"` is like a backspace in string. This means that string `"a#bc#d"` actually is `"bd"` Your task is to process a string with `"#"` symbols. ## Examples ``` "abc#d##c" ==> "ac" "abc##d######" ==> "" "#######" ==> "" "" ==> "" ``` def clean_string(s): stk = [] for c in ...
apps_data_4571
Decompose a number `num` into an array (tuple in Haskell, array of arrays `long[][]` in C# or Java) of the form `[[k1,k2,k3...], r]`, `([k1,k2,k3...], r)` in Haskell, `[[k1,k2,k3...], [r]]` in C# or Java) such that: 1. each kn is more than one 2. eack kn is maximized (first maximizing for 2 then 3 then 4 and so on) 3...
apps_data_4572
Given a string (`str`) containing a base-10 integer between `0` and `10000`, convert the integer to its binary representation. At that point, obtain a count of the maximum amount of consecutive 0s. From there, return the count in written form with a capital letter. In the very first example, we have an argument of `"9...
apps_data_4573
### Task You've just moved into a perfectly straight street with exactly ```n``` identical houses on either side of the road. Naturally, you would like to find out the house number of the people on the other side of the street. The street looks something like this: -------------------- ### Street ``` 1| |6 3| |4 5...
apps_data_4574
In this Kata you are a builder and you are assigned a job of building a wall with a specific size (God knows why...). Create a function called `build_a_wall` (or `buildAWall` in JavaScript) that takes `x` and `y` as integer arguments (which represent the number of rows of bricks for the wall and the number of bricks i...
apps_data_4575
# Task You're given a two-dimensional array of integers `matrix`. Your task is to determine the smallest non-negative integer that is not present in this array. # Input/Output - `[input]` 2D integer array `matrix` A non-empty rectangular matrix. `1 ≤ matrix.length ≤ 10` `1 ≤ matrix[0].length ≤ 10` - `[o...
apps_data_4576
You are given two positive integer lists with a random number of elements (1 <= n <= 100). Create a [GCD](https://en.wikipedia.org/wiki/Greatest_common_divisor) matrix and calculate the average of all values. Return a float value rounded to 3 decimal places. ## Example ``` a = [1, 2, 3] b = [4, 5, 6] # a =...
apps_data_4577
Take debugging to a whole new level: Given a string, remove every *single* bug. This means you must remove all instances of the word 'bug' from within a given string, *unless* the word is plural ('bugs'). For example, given 'obugobugobuoobugsoo', you should return 'ooobuoobugsoo'. Another example: given 'obbugugo',...
apps_data_4578
Your wizard cousin works at a Quidditch stadium and wants you to write a function that calculates the points for the Quidditch scoreboard! # Story Quidditch is a sport with two teams. The teams score goals by throwing the Quaffle through a hoop, each goal is worth **10 points**. The referee also deducts 30 points (...
apps_data_4579
## Task: You have to write a function `pattern` which returns the following Pattern(See Examples) upto n number of rows. * Note:```Returning``` the pattern is not the same as ```Printing``` the pattern. ### Rules/Note: * The pattern should be created using only unit digits. * If `n < 1` then it should return "" i....
apps_data_4580
# Task Some children are playing rope skipping game. Children skip the rope at roughly the same speed: `once per second`. If the child fails during the jump, he needs to tidy up the rope and continue. This will take `3 seconds`. You are given an array `failedCount`, where each element is the jump count at the failed. ...
apps_data_4581
# Task Two arrays are called similar if one can be obtained from another by swapping at most one pair of elements. Given two arrays, check whether they are similar. # Example For `A = [1, 2, 3]` and `B = [1, 2, 3]`, the output should be `true;` For `A = [1, 2, 3]` and `B = [2, 1, 3]`, the output should be `true;` ...
apps_data_4582
Sam is an avid collector of numbers. Every time he finds a new number he throws it on the top of his number-pile. Help Sam organise his collection so he can take it to the International Number Collectors Conference in Cologne. Given an array of numbers, your function should return an array of arrays, where each subar...
apps_data_4583
There is no single treatment that works for every phobia, but some people cure it by being gradually exposed to the phobic situation or object. In this kata we will try curing arachnophobia by drawing primitive spiders. Our spiders will have legs, body, eyes and a mouth. Here are some examples: ``` /\((OOwOO))/\ /╲(...
apps_data_4584
Given a set of numbers, return the additive inverse of each. Each positive becomes negatives, and the negatives become positives. ~~~if-not:racket ``` invert([1,2,3,4,5]) == [-1,-2,-3,-4,-5] invert([1,-2,3,-4,5]) == [-1,2,-3,4,-5] invert([]) == [] ``` ~~~ ```if:javascript,python,ruby,php,elixir,dart You can assume th...
apps_data_4585
## Task You are given three non negative integers `a`, `b` and `n`, and making an infinite sequence just like fibonacci sequence, use the following rules: - step 1: use `ab` as the initial sequence. - step 2: calculate the sum of the last two digits of the sequence, and append it to the end of sequence. - repeat step...
apps_data_4586
# Background My TV remote control has arrow buttons and an `OK` button. I can use these to move a "cursor" on a logical screen keyboard to type "words"... The screen "keyboard" layout looks like this #tvkb { width : 300px; border: 5px solid gray; border-collapse: collapse; } #tvkb td { color : or...
apps_data_4587
In this Kata you are to implement a function that parses a string which is composed from tokens of the form 'n1-n2,n3,n4-n5:n6' where 'nX' is a positive integer. Each token represent a different range: 'n1-n2' represents the range n1 to n2 (inclusive in both ends). 'n3' represents the single integer n3. 'n4-n5:n6' rep...
apps_data_4588
# Situation You have been hired by a company making electric garage doors. Accidents with the present product line have resulted in numerous damaged cars, broken limbs and several killed pets. Your mission is to write a safer version of their controller software. # Specification We always start with a closed door. The...
apps_data_4589
Complete the solution. It should try to retrieve the value of the array at the index provided. If the index is out of the array's max bounds then it should return the default value instead. Example: ```Haskell solution [1..3] 1 1000 `shouldBe` 2 solution [1..5] (10) 1000 `shouldBe` 1000 -- negative values work as lon...
apps_data_4590
Create an OR function, without use of the 'or' keyword, that takes an list of boolean values and runs OR against all of them. Assume there will be between 1 and 6 variables, and return None for an empty list. def alt_or(lst): return any(lst) if lst else None def alt_or(lst): return bool(sum(lst)) if lst else Non...
apps_data_4591
The Spelling Bee bees are back... # How many bees are in the beehive? * bees can be facing UP, DOWN, LEFT, RIGHT, and now also _diagonally_ up/down/left/right * bees can share parts of other bees ## Examples Ex1 ``` bee.bee .e..e.. .b..eeb ``` _Answer: 5_ Ex2 ``` beee.. eeb.e. ebee.b ``` _Answer: 7_ d...
apps_data_4592
Regular Tic-Tac-Toe is boring. That's why in this Kata you will be playing Tic-Tac-Toe in **3D** using a 4 x 4 x 4 matrix! # Kata Task Play the game. Work out who wins. Return a string * `O wins after moves` * `X wins after moves` * `No winner` # Rules * Player `O` always goes first * Input `moves` is list/...
apps_data_4593
You are given two sorted arrays that contain only integers. Your task is to find a way to merge them into a single one, sorted in **ascending order**. Complete the function `mergeArrays(arr1, arr2)`, where `arr1` and `arr2` are the original sorted arrays. You don't need to worry about validation, since `arr1` and `arr...
apps_data_4594
Write a function that outputs the transpose of a matrix - a new matrix where the columns and rows of the original are swapped. For example, the transpose of: | 1 2 3 | | 4 5 6 | is | 1 4 | | 2 5 | | 3 6 | The input to your function will be an array of matrix rows. You can assume that each row...
apps_data_4595
# Task In the Land Of Chess, bishops don't really like each other. In fact, when two bishops happen to stand on the same diagonal, they immediately rush towards the opposite ends of that same diagonal. Given the initial positions (in chess notation) of two bishops, `bishop1` and `bishop2`, calculate their future pos...
apps_data_4596
Write a function that takes a number or a string and gives back the number of **permutations without repetitions** that can generated using all of its element.; more on permutations [here](https://en.wikipedia.org/wiki/Permutation). For example, starting with: ``` 1 45 115 "abc" ``` You could respectively generate: `...
apps_data_4597
Write ```python function combine() ``` that combines arrays by alternatingly taking elements passed to it. E.g ```python combine(['a', 'b', 'c'], [1, 2, 3]) == ['a', 1, 'b', 2, 'c', 3] combine(['a', 'b', 'c'], [1, 2, 3, 4, 5]) == ['a', 1, 'b', 2, 'c', 3, 4, 5] combine(['a', 'b', 'c'], [1, 2, 3, 4, 5], [6, 7], [8]) ...
apps_data_4598
In this kata you need to write a function that will receive two strings (```n1``` and ```n2```), each representing an integer as a binary number. A third parameter will be provided (```o```) as a string representing one of the following operators: add, subtract, multiply. Your task is to write the calculate function s...
apps_data_4599
To pass the series of gates guarded by the owls, Kenneth needs to present them each with a highly realistic portrait of one. Unfortunately, he is absolutely rubbish at drawing, and needs some code to return a brand new portrait with a moment's notice. All owl heads look like this: ''0v0'' Such beautiful eyes! H...