id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_4400
# Task **_Given_** *an array of N integers, you have to find* **_how many times_** *you have to* **_add up the smallest numbers_** *in the array until* **_their Sum_** *becomes greater or equal to* **_K_**. ___ # Notes: * **_List size_** is *at least 3*. * **_All numbers_** *will be* **_positive_**. * **_Num...
apps_data_4401
In geometry, a cube is a three-dimensional solid object bounded by six square faces, facets or sides, with three meeting at each vertex.The cube is the only regular hexahedron and is one of the five Platonic solids. It has 12 edges, 6 faces and 8 vertices.The cube is also a square parallelepiped, an equilateral cuboid ...
apps_data_4402
In this Kata, we will check if a string contains consecutive letters as they appear in the English alphabet and if each letter occurs only once. ```Haskell Rules are: (1) the letters are adjacent in the English alphabet, and (2) each letter occurs only once. For example: solve("abc") = True, because it contains a,b...
apps_data_4403
In computing, there are two primary byte order formats: big-endian and little-endian. Big-endian is used primarily for networking (e.g., IP addresses are transmitted in big-endian) whereas little-endian is used mainly by computers with microprocessors. Here is an example (using 32-bit integers in hex format): Little-...
apps_data_4404
Section numbers are strings of dot-separated integers. The highest level sections (chapters) are numbered 1, 2, 3, etc. Second level sections are numbered 1.1, 1.2, 1.3, 2.1, 2.2, 2.3, etc. Next level sections are numbered 1.1.1, 1.1.2, 1.1.2, 1.2.1, 1.2.2, erc. There is no bound on the number of sections a document ma...
apps_data_4405
# Palindrome strings A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. This includes capital letters, punctuation, and word dividers. Implement a function that checks if something is a palindrome. ## Examples ``` isPalindrome("anna") ==> true isPalind...
apps_data_4406
Linear Kingdom has exactly one tram line. It has `n` stops, numbered from 1 to n in the order of tram's movement. At the i-th stop ai passengers exit the tram, while bi passengers enter it. The tram is empty before it arrives at the first stop. ## Your task Calculate the tram's minimum capacity such that the number o...
apps_data_4407
Write a function that accepts two parameters (a and b) and says whether a is smaller than, bigger than, or equal to b. Here is an example code: var noIfsNoButs = function (a,b) { if(a > b) return a + " is greater than " + b else if(a < b) return a + " is smaller than " + b else if(a == b) return a + " is equal t...
apps_data_4408
Description Lets imagine a yoga classroom as a Square 2D Array of Integers ```classroom```, with each integer representing a person, and the value representing their skill level. ``` classroom = [ [3,2,1,3], [1,3,2,1], [1,1,1,2], ] poses = [1,7,5,9,10,21,4,...
apps_data_4409
Spoonerize... with numbers... numberize?... numboonerize?... noonerize? ...anyway! If you don't yet know what a spoonerism is and haven't yet tried my spoonerism kata, please do [check it out](http://www.codewars.com/kata/spoonerize-me) first. You will create a function which takes an array of two positive integers, ...
apps_data_4410
.task { background: #fff; color: #333; padding: 25px; box-sizing: border-box; font-family: Comfortaa, sans-serif !important; position: relative; } .task code, .task_code { display: inline-block; padding: 0; border-radius: 2px; margin: 0; position: relative; top: 6px; background: bisque; bord...
apps_data_4411
# Background: You're working in a number zoo, and it seems that one of the numbers has gone missing! Zoo workers have no idea what number is missing, and are too incompetent to figure it out, so they're hiring you to do it for them. In case the zoo loses another number, they want your program to work regardless of h...
apps_data_4412
We have the integer `9457`. We distribute its digits in two buckets having the following possible distributions (we put the generated numbers as strings and we add the corresponding formed integers for each partition): ``` - one bucket with one digit and the other with three digits [['9'], ['4','5','7']] --> ['9','4...
apps_data_4413
## Task Complete function `splitOddAndEven`, accept a number `n`(n>0), return an array that contains the continuous parts of odd or even digits. Please don't worry about digit `0`, it won't appear ;-) ## Examples def split_odd_and_even(n): import re return [int(i) for i in re.findall(r"[2468]+|[1357...
apps_data_4414
Karan's company makes software that provides different features based on the version of operating system of the user. For finding which version is more recent, Karan uses the following method: While this function worked for OS versions 10.6, 10.7, 10.8 and 10.9, the Operating system company just released OS version 1...
apps_data_4415
We have an array with string digits that occurrs more than once, for example, ```arr = ['1', '2', '2', '2', '3', '3']```. How many different string numbers can be generated taking the 6 elements at a time? We present the list of them below in an unsorted way: ``` ['223213', '312322', '223312', '222133', '312223', '22...
apps_data_4416
Welcome young Jedi! In this Kata you must create a function that takes an amount of US currency in `cents`, and returns a dictionary/hash which shows the least amount of coins used to make up that amount. The only coin denominations considered in this exercise are: `Pennies (1¢), Nickels (5¢), Dimes (10¢) and Quarters ...
apps_data_4417
Consider the prime number `23`. If we sum the square of its digits we get: `2^2 + 3^2 = 13`, then for `13: 1^2 + 3^2 = 10`, and finally for `10: 1^2 + 0^2 = 1`. Similarly, if we start with prime number `7`, the sequence is: `7->49->97->130->10->1`. Given a range, how many primes within that range will eventually end...
apps_data_4418
This is a follow-up from my previous Kata which can be found here: http://www.codewars.com/kata/5476f4ca03810c0fc0000098 This time, for any given linear sequence, calculate the function [f(x)] and return it as a function in Javascript or Lambda/Block in Ruby. For example: ```python get_function([0, 1, 2, 3, 4])(5) =...
apps_data_4419
Perhaps it would be convenient to solve first ```Probabilities for Sums in Rolling Cubic Dice``` see at: http://www.codewars.com/kata/probabilities-for-sums-in-rolling-cubic-dice Suppose that we roll dice that we never used, a tetrahedral die that has only 4 sides(values 1 to 4), or perhaps better the dodecahedral one...
apps_data_4420
Every number may be factored in prime factors. For example, the number 18 may be factored by its prime factors ``` 2 ``` and ```3``` ``` 18 = 2 . 3 . 3 = 2 . 3² ``` The sum of the prime factors of 18 is ```2 + 3 + 3 = 8``` But some numbers like 70 are divisible by the sum of its prime factors: ``` 70 = 2 . 5 . 7 # s...
apps_data_4421
Implement a class/function, which should parse time expressed as `HH:MM:SS`, or `null/nil/None` otherwise. Any extra characters, or minutes/seconds higher than 59 make the input invalid, and so should return `null/nil/None`. def to_seconds(time): try: s, m, h = int(time[-2:]), int(time[3:5]), int(time[:2]...
apps_data_4422
Welcome This kata is inspired by This Kata We have a string s We have a number n Here is a function that takes your string, concatenates the even-indexed chars to the front, odd-indexed chars to the back. Examples s = "Wow Example!" result = "WwEapeo xml!" s = "I'm JomoPipi" result = "ImJm ii' oo...
apps_data_4423
In the previous Kata we discussed the OR case. We will now discuss the AND case, where rather than calculating the probablility for either of two (or more) possible results, we will calculate the probability of receiving all of the viewed outcomes. For example, if we want to know the probability of receiving head OR ...
apps_data_4424
# Task * **_Given_** *three integers* `a` ,`b` ,`c`, **_return_** *the **_largest number_** obtained after inserting the following operators and brackets*: `+`, `*`, `()` * In other words , **_try every combination of a,b,c with [*+()] , and return the Maximum Obtained_** ___ # Consider an Example : **_With the numbe...
apps_data_4425
There's a **"3 for 2"** (or **"2+1"** if you like) offer on mangoes. For a given quantity and price (per mango), calculate the total cost of the mangoes. ### Examples ```python mango(3, 3) ==> 6 # 2 mangoes for 3 = 6; +1 mango for free mango(9, 5) ==> 30 # 6 mangoes for 5 = 30; +3 mangoes for free ``` def mango(...
apps_data_4426
Your task it to return ```true``` if the fractional part (rounded to 1 digit) of the result (```a``` / ```b```) exists, more than ```0``` and is multiple of ```n```. Otherwise return ```false```. (For Python return True or False) All arguments are positive digital numbers. Rounding works like toFixed() method. (if mo...
apps_data_4427
# Task Given an array of integers, sum consecutive even numbers and consecutive odd numbers. Repeat the process while it can be done and return the length of the final array. # Example For `arr = [2, 1, 2, 2, 6, 5, 0, 2, 0, 5, 5, 7, 7, 4, 3, 3, 9]` The result should be `6`. ``` [2, 1, 2, 2, 6, 5, 0, 2, 0, 5, 5, 7...
apps_data_4428
In this kata you're expected to sort an array of 32-bit integers in ascending order of the number of **on** bits they have. E.g Given the array **[7, 6, 15, 8]** - 7 has **3 on** bits (000...0**111**) - 6 has **2 on** bits (000...00**11**) - 15 has **4 on** bits (000...**1111**) - 8 has **1 on** bit (000...**1**0...
apps_data_4429
A palindrome is a series of characters that read the same forwards as backwards such as "hannah", "racecar" and "lol". For this Kata you need to write a function that takes a string of characters and returns the length, as an integer value, of longest alphanumeric palindrome that could be made by combining the charact...
apps_data_4430
Write a function ```python vowel_2_index``` that takes in a string and replaces all the vowels [a,e,i,o,u] with their respective positions within that string. E.g: ```python vowel_2_index('this is my string') == 'th3s 6s my str15ng' vowel_2_index('Codewars is the best site in the world') == 'C2d4w6rs 10s th15 b18...
apps_data_4431
You have managed to intercept an important message and you are trying to read it. You realise that the message has been encoded and can be decoded by switching each letter with a corresponding letter. You also notice that each letter is paired with the letter that it coincides with when the alphabet is reversed. For...
apps_data_4432
Jump is a simple one-player game: You are initially at the first cell of an array of cells containing non-negative integers; At each step you can jump ahead in the array as far as the integer at the current cell, or any smaller number of cells. You win if there is a path that allows you to jump from one cell to anoth...
apps_data_4433
Your task is to calculate logical value of boolean array. Test arrays are one-dimensional and their size is in the range 1-50. Links referring to logical operations: [AND](https://en.wikipedia.org/wiki/Logical_conjunction), [OR](https://en.wikipedia.org/wiki/Logical_disjunction) and [XOR](https://en.wikipedia.org/wiki...
apps_data_4434
You need to write a function, that returns the first non-repeated character in the given string. For example for string `"test"` function should return `'e'`. For string `"teeter"` function should return `'r'`. If a string contains all unique characters, then return just the first character of the string. Exa...
apps_data_4435
Similarly to the [previous kata](https://www.codewars.com/kata/string-subpattern-recognition-i/), you will need to return a boolean value if the base string can be expressed as the repetition of one subpattern. This time there are two small changes: * if a subpattern has been used, it will be repeated at least twice,...
apps_data_4436
# Task Your task is to find the sum for the range `0 ... m` for all powers from `0 ... n. # Example For `m = 2, n = 3`, the result should be `20` `0^0+1^0+2^0 + 0^1+1^1+2^1 + 0^2+1^2+2^2 + 0^3+1^3+2^3 = 20` Note, that no output ever exceeds 2e9. # Input/Output - `[input]` integer m `0 <= m <= 50000` ...
apps_data_4437
For this problem you must create a program that says who ate the last cookie. If the input is a string then "Zach" ate the cookie. If the input is a float or an int then "Monica" ate the cookie. If the input is anything else "the dog" ate the cookie. The way to return the statement is: "Who ate the last cookie? It was ...
apps_data_4438
For this kata, you are given three points ```(x1,y1,z1)```, ```(x2,y2,z2)```, and ```(x3,y3,z3)``` that lie on a straight line in 3-dimensional space. You have to figure out which point lies in between the other two. Your function should return 1, 2, or 3 to indicate which point is the in-between one. def middle_poin...
apps_data_4439
# Task Find the integer from `a` to `b` (included) with the greatest number of divisors. For example: ``` divNum(15, 30) ==> 24 divNum(1, 2) ==> 2 divNum(0, 0) ==> 0 divNum(52, 156) ==> 120 ``` If there are several numbers that have the same (maximum) number of divisors, the smallest among them should be ...
apps_data_4440
ATM machines allow 4 or 6 digit PIN codes and PIN codes cannot contain anything but **exactly** 4 digits or exactly 6 digits. If the function is passed a valid PIN string, return `true`, else return `false`. ## Examples ``` "1234" --> true "12345" --> false "a234" --> false ``` def validate_pin(pin): r...
apps_data_4441
Lot of junior developer can be stuck when they need to change the access permission to a file or a directory in an Unix-like operating systems. To do that they can use the `chmod` command and with some magic trick they can change the permissionof a file or a directory. For more information about the `chmod` command yo...
apps_data_4442
Your task is very simple. Given an input string s, case\_sensitive(s), check whether all letters are lowercase or not. Return True/False and a list of all the entries that are not lowercase in order of their appearance in s. For example, case\_sensitive('codewars') returns [True, []], but case\_sensitive('codeWaRs') r...
apps_data_4443
You throw a ball vertically upwards with an initial speed `v (in km per hour)`. The height `h` of the ball at each time `t` is given by `h = v*t - 0.5*g*t*t` where `g` is Earth's gravity `(g ~ 9.81 m/s**2)`. A device is recording at every **tenth of second** the height of the ball. For example with `v = 15 km/h` the de...
apps_data_4444
An abundant number or excessive number is a number for which the sum of its proper divisors is greater than the number itself. The integer 12 is the first abundant number. Its proper divisors are 1, 2, 3, 4 and 6 for a total of 16 (> 12). Derive function `abundantNumber(num)/abundant_number(num)` which returns `true...
apps_data_4445
[Haikus](https://en.wikipedia.org/wiki/Haiku_in_English) are short poems in a three-line format, with 17 syllables arranged in a 5–7–5 pattern. Your task is to check if the supplied text is a haiku or not. ### About syllables [Syllables](https://en.wikipedia.org/wiki/Syllable) are the phonological building blocks of...
apps_data_4446
Write function ```wordsToSentence``` which will create a string from a list of strings, separated by space. Example: ```["hello", "world"] -> "hello world"``` words_to_sentence=' '.join def words_to_sentence(words): return ' '.join(words) def words_to_sentence(a): return " ".join(a) def words_to_sentence(...
apps_data_4447
# Task Consider a string of lowercase Latin letters and space characters (" "). First, rearrange the letters in each word `alphabetically`. And then rearrange the words in ascending order of the sum of their characters' `ASCII` values. If two or more words have the same `ASCII` value, rearrange them by the...
apps_data_4448
I need some help with my math homework. I have a number of problems I need to return the derivative for. They will all be of the form: ax^b, A and B are both integers, but can be positive or negative. Note: - if b is 1, then the equation will be ax. - if b is 0, then the equation will be 0. Examples: ...
apps_data_4449
There are some stones on Bob's table in a row, and each of them can be red, green or blue, indicated by the characters `R`, `G`, and `B`. Help Bob find the minimum number of stones he needs to remove from the table so that the stones in each pair of adjacent stones have different colours. Examples: ``` "RGBRGBRGGB" ...
apps_data_4450
Create the function ```consecutive(arr)``` that takes an array of integers and return the minimum number of integers needed to make the contents of ```arr``` consecutive from the lowest number to the highest number. For example: If ```arr``` contains [4, 8, 6] then the output should be 2 because two numbers need to be...
apps_data_4451
I have the `par` value for each hole on a golf course and my stroke `score` on each hole. I have them stored as strings, because I wrote them down on a sheet of paper. Right now, I'm using those strings to calculate my golf score by hand: take the difference between my actual `score` and the `par` of the hole, and add...
apps_data_4452
The written representation of a number (with 4 or more digits) can be split into three parts in various different ways. For example, the written number 1234 can be split as [1 | 2 | 34] or [1 | 23 | 4] or [12 | 3 | 4]. Given a written number, find the highest possible product from splitting it into three parts and mul...
apps_data_4453
# Summary: Given a number, `num`, return the shortest amount of `steps` it would take from 1, to land exactly on that number. # Description: A `step` is defined as either: - Adding 1 to the number: `num += 1` - Doubling the number: `num *= 2` You will always start from the number `1` and you will have to return the s...
apps_data_4454
Prior to having fancy iPhones, teenagers would wear out their thumbs sending SMS messages on candybar-shaped feature phones with 3x4 numeric keypads. ------- ------- ------- | | | ABC | | DEF | | 1 | | 2 | | 3 | ------- ------- ------- ------- ------- ------- | GHI | | JKL | | MNO | ...
apps_data_4455
Consider integer coordinates x, y in the Cartesian plan and three functions f, g, h defined by: ``` f: 1 <= x <= n, 1 <= y <= n --> f(x, y) = min(x, y) g: 1 <= x <= n, 1 <= y <= n --> g(x, y) = max(x, y) h: 1 <= x <= n, 1 <= y <= n --> h(x, y) = x + y ``` where n is a given integer (n >= 1, guaranteed) and x, y are in...
apps_data_4456
In this kata, your task is to create a function that takes a single list as an argument and returns a flattened list. The input list will have a maximum of one level of nesting (list(s) inside of a list). ```python # no nesting [1, 2, 3] # one level of nesting [1, [2, 3]] ``` --- # Examples ```python >>> flatten_me...
apps_data_4457
Have you heard about Megamind? Megamind and Metro Man are two aliens who came to earth. Megamind wanted to destroy the earth, while Metro Man wanted to stop him and protect mankind. After a lot of fighting, Megamind finally threw Metro Man up into the sky. Metro Man was defeated and was never seen again. Megamind wante...
apps_data_4458
A new task for you! You have to create a method, that corrects a given time string. There was a problem in addition, so many of the time strings are broken. Time-Format is european. So from "00:00:00" to "23:59:59". Some examples: "09:10:01" -> "09:10:01" "11:70:10" -> "12:10:10" "19:99:99" -> "20:40:39" "24:01:01"...
apps_data_4459
Return the Nth Even Number The input will not be 0. def nth_even(n): return 2 * (n - 1); def nth_even(n): return n * 2 - 2 def nth_even(n): return (n-1)*2; nth_even = lambda x: 2 * (x - 1) nth_even = lambda n: (n - 1) * 2 def nth_even(n): '''import numpy as np np.even1=0 #even1 = long(ev...
apps_data_4460
Complete the function which returns the weekday according to the input number: * `1` returns `"Sunday"` * `2` returns `"Monday"` * `3` returns `"Tuesday"` * `4` returns `"Wednesday"` * `5` returns `"Thursday"` * `6` returns `"Friday"` * `7` returns `"Saturday"` * Otherwise returns `"Wrong, please enter a number betwee...
apps_data_4461
# Task You are given n rectangular boxes, the ith box has the length lengthi, the width widthi and the height heighti. Your task is to check if it is possible to pack all boxes into one so that inside each box there is no more than one another box (which, in turn, can contain at most one another box, and so on). ...
apps_data_4462
## Task **_Given_** *an array of integers* , **_Find_** **_the maximum product_** *obtained from multiplying 2 adjacent numbers in the array*. ____ # Notes * **_Array/list_** size is *at least 2*. * **_Array/list_** numbers could be a *mixture of positives, negatives also zeroes* . ___ # Input >> Output Examples `...
apps_data_4463
Welcome. In this kata you are required to, given a string, replace every letter with its position in the alphabet. If anything in the text isn't a letter, ignore it and don't return it. `"a" = 1`, `"b" = 2`, etc. ## Example ```python alphabet_position("The sunset sets at twelve o' clock.") ``` Should return `"20 8...
apps_data_4464
All of the animals are having a feast! Each animal is bringing one dish. There is just one rule: the dish must start and end with the same letters as the animal's name. For example, the great blue heron is bringing garlic naan and the chickadee is bringing chocolate cake. Write a function `feast` that takes the animal...
apps_data_4465
Write a function that rearranges an integer into its largest possible value. ```python super_size(123456) # 654321 super_size(105) # 510 super_size(12) # 21 ``` ``` haskell superSize 123456 `shouldBe` 654321 superSize 105 `shouldBe` 510 superSize 12 `shouldBe` 21 ``` If the argument passed throu...
apps_data_4466
# Task **Your task** is to implement function `printNumber` (`print_number` in C/C++ and Python `Kata.printNumber` in Java) that returns string that represents given number in text format (see examples below). Arguments: - `number` — Number that we need to print (`num` in C/C++/Java) - `char` — Character for buildi...
apps_data_4467
Write a function that takes a string and returns an array of the repeated characters (letters, numbers, whitespace) in the string. If a charater is repeated more than once, only show it once in the result array. Characters should be shown **by the order of their first repetition**. Note that this may be different fro...
apps_data_4468
## Task Given a positive integer as input, return the output as a string in the following format: Each element, corresponding to a digit of the number, multiplied by a power of 10 in such a way that with the sum of these elements you can obtain the original number. ## Examples Input | Output --- | --- 0 | ""...
apps_data_4469
A Narcissistic Number is a number of length n in which the sum of its digits to the power of n is equal to the original number. If this seems confusing, refer to the example below. Ex: 153, where n = 3 (number of digits in 153) 1^(3) + 5^(3) + 3^(3) = 153 Write a method is_narcissistic(i) (in Haskell: isNarcissistic ...
apps_data_4470
In a small town the population is `p0 = 1000` at the beginning of a year. The population regularly increases by `2 percent` per year and moreover `50` new inhabitants per year come to live in the town. How many years does the town need to see its population greater or equal to `p = 1200` inhabitants? ``` At the end o...
apps_data_4471
# Task N lamps are placed in a line, some are switched on and some are off. What is the smallest number of lamps that need to be switched so that on and off lamps will alternate with each other? You are given an array `a` of zeros and ones - `1` mean switched-on lamp and `0` means switched-off. Your task is to find ...
apps_data_4472
A population of bears consists of black bears, brown bears, and white bears. The input is an array of two elements. Determine whether the offspring of the two bears will return `'black'`, `'brown'`, `'white'`, `'dark brown'`, `'grey'`, `'light brown'`, or `'unknown'`. Elements in the the array will always be a stri...
apps_data_4473
In this Kata you are a game developer and have programmed the #1 MMORPG(Massively Multiplayer Online Role Playing Game) worldwide!!! Many suggestions came across you to make the game better, one of which you are interested in and will start working on at once. Players in the game have levels from 1 to 170, XP(short fo...
apps_data_4474
Timothy (age: 16) really likes to smoke. Unfortunately, he is too young to buy his own cigarettes and that's why he has to be extremely efficient in smoking. It's now your task to create a function that calculates how many cigarettes Timothy can smoke out of the given amounts of `bars` and `boxes`: - a bar has 10 box...
apps_data_4475
If you have not ever heard the term **Arithmetic Progrossion**, refer to: http://www.codewars.com/kata/find-the-missing-term-in-an-arithmetic-progression/python And here is an unordered version. Try if you can survive lists of **MASSIVE** numbers (which means time limit should be considered). :D Note: Don't be afrai...
apps_data_4476
Find the closest prime number under a certain integer ```n``` that has the maximum possible amount of even digits. For ```n = 1000```, the highest prime under ```1000``` is ```887```, having two even digits (8 twice) Naming ```f()```, the function that gives that prime, the above case and others will be like the foll...
apps_data_4477
Given a number, write a function to output its reverse digits. (e.g. given 123 the answer is 321) Numbers should preserve their sign; i.e. a negative number should still be negative when reversed. ### Examples ``` 123 -> 321 -456 -> -654 1000 -> 1 ``` def reverse_number(n): """ Reverse a number, prese...
apps_data_4478
Hello everyone. I have a simple challenge for you today. In mathematics, the formula for finding the sum to infinity of a geometric sequence is: **ONLY IF** `-1 < r < 1` where: * `a` is the first term of the sequence * `r` is the common ratio of the sequence (calculated by dividing one term in the sequence by th...
apps_data_4479
Given an array (or list or vector) of arrays (or, guess what, lists or vectors) of integers, your goal is to return the sum of a specific set of numbers, starting with elements whose position is equal to the main array length and going down by one at each step. Say for example the parent array (etc, etc) has 3 sub-arr...
apps_data_4480
Write a simple parser that will parse and run Deadfish. Deadfish has 4 commands, each 1 character long: * `i` increments the value (initially `0`) * `d` decrements the value * `s` squares the value * `o` outputs the value into the return array Invalid characters should be ignored. ```python parse("iiisdoso") ==> ...
apps_data_4481
Imagine there's a big cube consisting of n^3 small cubes. Calculate, how many small cubes are not visible from outside. For example, if we have a cube which has 4 cubes in a row, then the function should return 8, because there are 8 cubes inside our cube (2 cubes in each dimension) def not_visible_cubes(n): retu...
apps_data_4482
# Task Given array of integers `sequence` and some integer `fixedElement`, output the number of `even` values in sequence before the first occurrence of `fixedElement` or `-1` if and only if `fixedElement` is not contained in sequence. # Input/Output `[input]` integer array `sequence` A non-empty array of positiv...
apps_data_4483
## Description You are a *Fruit Ninja*, your skill is cutting fruit. All the fruit will be cut in half by your knife. For example: ``` [ "apple", "pear", "banana" ] --> ["app", "le", "pe", "ar", "ban", "ana"] ``` As you see, all fruits are cut in half. You should pay attention to `"apple"`: if you cannot cu...
apps_data_4484
Write a function called calculate that takes 3 values. The first and third values are numbers. The second value is a character. If the character is "+" , "-", "*", or "/", the function will return the result of the corresponding mathematical function on the two numbers. If the string is not one of the specified charact...
apps_data_4485
You task is to implement an simple interpreter for the notorious esoteric language [HQ9+](https://esolangs.org/wiki/HQ9+) that will work for a single character input: - If the input is `'H'`, return `'Hello World!'` - If the input is `'Q'`, return the input - If the input is `'9'`, return the full lyrics of [99 Bottle...
apps_data_4486
Create a function that takes a string and an integer (`n`). The function should return a string that repeats the input string `n` number of times. If anything other than a string is passed in you should return `"Not a string"` ## Example ``` "Hi", 2 --> "HiHi" 1234, 5 --> "Not a string" ``` def repeat_it(string,n...
apps_data_4487
Write a function that takes a single array as an argument (containing multiple strings and/or positive numbers and/or arrays), and returns one of four possible string values, depending on the ordering of the lengths of the elements in the input array: Your function should return... - “Increasing” - if the lengths of ...
apps_data_4488
`Description:` Given an input array (`arr`) of positive integers, the objective is to return an output array where each index represents the amount of times an element appeared (frequency) in the input array. More specifically, the element at each index of the output array will be an array (bucket) containing intege...
apps_data_4489
You are given a list/array which contains only integers (positive and negative). Your job is to sum only the numbers that are the same and consecutive. The result should be one list. Extra credit if you solve it in one line. You can assume there is never an empty list/array and there will always be an integer. Same ...
apps_data_4490
The Collatz conjecture is one of the most famous one. Take any positive integer n, if it is even divide it by 2, if it is odd multiply it by 3 and add 1 and continue indefinitely.The conjecture is that whatever is n the sequence will reach 1. There is many ways to approach this problem, each one of them had given beaut...
apps_data_4491
In this Kata, you will be given two strings `a` and `b` and your task will be to return the characters that are not common in the two strings. For example: ```Haskell solve("xyab","xzca") = "ybzc" --The first string has 'yb' which is not in the second string. --The second string has 'zc' which is not in the first s...
apps_data_4492
You're looking through different hex codes, and having trouble telling the difference between #000001 and #100000 We need a way to tell which is red, and which is blue! That's where you create ```hex_color()```! It should read an RGB input, and return whichever value (red, blue, or green) is of greatest concentr...
apps_data_4493
As you probably know, Fibonacci sequence are the numbers in the following integer sequence: 1, 1, 2, 3, 5, 8, 13... Write a method that takes the index as an argument and returns last digit from fibonacci number. Example: getLastDigit(15) - 610. Your method must return 0 because the last digit of 610 is 0. Fibonacci ...
apps_data_4494
Our football team finished the championship. The result of each match look like "x:y". Results of all matches are recorded in the collection. For example: ```["3:1", "2:2", "0:1", ...]``` Write a function that takes such collection and counts the points of our team in the championship. Rules for counting points for e...
apps_data_4495
I've got a crazy mental illness. I dislike numbers a lot. But it's a little complicated: The number I'm afraid of depends on which day of the week it is... This is a concrete description of my mental illness: Monday --> 12 Tuesday --> numbers greater than 95 Wednesday --> 34 Thursday --> 0 Friday -->...
apps_data_4496
The hamming distance of two equal-length strings is the number of positions, in which the two string differ. In other words, the number of character substitutions required to transform one string into the other. For this first Kata, you will write a function ```hamming_distance(a, b)``` with two equal-length strings ...
apps_data_4497
Given an array of one's and zero's that represents a positive binary number convert the number to two's complement value. Two's complement is the way most computers represent positive or negative integers. The most significant bit is negative. Examples: -8 4 2 1 [1,1,1,1] = -1 [1,0,0,0] = -8 [1,1,0,1] = -3 To ...
apps_data_4498
Create a function that takes a Roman numeral as its argument and returns its value as a numeric decimal integer. You don't need to validate the form of the Roman numeral. Modern Roman numerals are written by expressing each decimal digit of the number to be encoded separately, starting with the leftmost digit and skip...
apps_data_4499
# Convergents of e The square root of 2 can be written as an infinite continued fraction. ![img](http://img0.ph.126.net/x1Hyc4iHQg0Jz2EInmT3ag==/6597639313681841979.png) The infinite continued fraction can be written, √2 = [1;(2)], (2) indicates that 2 repeats ad infinitum. In a similar way, √23 = [4;(1,3,1,8)]. It ...