id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_3800
# Task John is new to spreadsheets. He is well aware of rows and columns, but he is not comfortable with spreadsheets numbering system. ``` Spreadsheet Row Column A1 R1C1 D5 R5C4 AA48 R48C27 BK12 R12C63``` Since John has a lot ...
apps_data_3801
If `a = 1, b = 2, c = 3 ... z = 26` Then `l + o + v + e = 54` and `f + r + i + e + n + d + s + h + i + p = 108` So `friendship` is twice stronger than `love` :-) The input will always be in lowercase and never be empty. def words_to_marks(s): return sum(ord(c)-96 for c in s) def words_to_marks(s): return su...
apps_data_3802
Alex just got a new hula hoop, he loves it but feels discouraged because his little brother is better than him Write a program where Alex can input (n) how many times the hoop goes round and it will return him an encouraging message :) -If Alex gets 10 or more hoops, return the string "Great, now move on to tricks"....
apps_data_3803
You will be given an array which lists the current inventory of stock in your store and another array which lists the new inventory being delivered to your store today. Your task is to write a function that returns the updated list of your current inventory **in alphabetical order**. ## Example ```python cur_stock =...
apps_data_3804
# Task: We define the "self reversed power sequence" as one shown below: Implement a function that takes 2 arguments (`ord max` and `num dig`), and finds the smallest term of the sequence whose index is less than or equal to `ord max`, and has exactly `num dig` number of digits. If there is a number with correct a...
apps_data_3805
You will be given an array of non-negative integers and positive integer bin width. Your task is to create the Histogram method that will return histogram data corresponding to the input array. The histogram data is an array that stores under index i the count of numbers that belong to bin i. The first bin always sta...
apps_data_3806
# Task In a black and white image we can use `1` instead of black pixels and `0` instead of white pixels. For compression image file we can reserve pixels by consecutive pixels who have the same color. Your task is to determine how much of black and white pixels is in each row sorted by place of those. # Exa...
apps_data_3807
Write ```python smaller(arr) ``` that given an array ```arr```, you have to return the amount of numbers that are smaller than ```arr[i]``` to the right. For example: ```python smaller([5, 4, 3, 2, 1]) == [4, 3, 2, 1, 0] smaller([1, 2, 0]) == [1, 1, 0] ``` ``` haskell smaller [5,4,3,2,1] `shouldBe` [4,3,2,1,0] smalle...
apps_data_3808
Remember the movie with David Bowie: 'The Labyrinth'? You can remember your childhood here: https://www.youtube.com/watch?v=2dgmgub8mHw In this scene the girl is faced with two 'Knights" and two doors. One door leads the castle where the Goblin King and her kid brother is, the other leads to certain death. She can as...
apps_data_3809
Cara is applying for several different jobs. The online application forms ask her to respond within a specific character count. Cara needs to check that her answers fit into the character limit. Annoyingly, some application forms count spaces as a character, and some don't. Your challenge: Write Cara a function `ch...
apps_data_3810
Complete the `greatestProduct` method so that it'll find the greatest product of five consecutive digits in the given string of digits. For example: The input string always has more than five digits. Adapted from Project Euler. from itertools import islice from functools import reduce def greatest_product(n): ...
apps_data_3811
This kata is part of the collection [Mary's Puzzle Books](https://www.codewars.com/collections/marys-puzzle-books). # Zero Terminated Sum Mary has another puzzle book, and it's up to you to help her out! This book is filled with zero-terminated substrings, and you have to find the substring with the largest sum of it...
apps_data_3812
Make your strings more nerdy: Replace all 'a'/'A' with 4, 'e'/'E' with 3 and 'l' with 1 e.g. "Fundamentals" --> "Fund4m3nt41s" ```if:csharp Documentation: Kata.Nerdify Method (String) Nerdifies a string. Returns a copy of the original string with 'a'/'A' characters replaced with '4', 'e'/'E' characters replaced with...
apps_data_3813
# Task Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion caused by the Mississippi River. Since Fred is hoping to live in this house the ...
apps_data_3814
Given a time in AM/PM format as a string, convert it to military (24-hour) time as a string. Midnight is 12:00:00AM on a 12-hour clock, and 00:00:00 on a 24-hour clock. Noon is 12:00:00PM on a 12-hour clock, and 12:00:00 on a 24-hour clock Sample Input: 07:05:45PM Sample Output: 19:05:45 Try not to use built in Dat...
apps_data_3815
Two integers are coprimes if the their only greatest common divisor is 1. ## Task In this kata you'll be given a number ```n >= 2``` and output a list with all positive integers less than ```gcd(n, k) == 1```, with ```k``` being any of the output numbers. The list cannot include duplicated entries and has to be sorte...
apps_data_3816
Move every letter in the provided string forward 10 letters through the alphabet. If it goes past 'z', start again at 'a'. Input will be a string with length > 0. from string import ascii_lowercase as al tbl = str.maketrans(al, al[10:] + al[:10]) def move_ten(st): return st.translate(tbl) def move_ten(st): ...
apps_data_3817
Most languages have a `split` function that lets you turn a string like `“hello world”` into an array like`[“hello”, “world”]`. But what if we don't want to lose the separator? Something like `[“hello”, “ world”]`. #### Task: Your job is to implement a function, (`split_without_loss` in Ruby/Crystal, and `splitWithou...
apps_data_3818
# Convert Improper Fraction to Mixed Number You will need to convert an [improper fraction](https://www.mathplacementreview.com/arithmetic/fractions.php#improper-fractions) to a [mixed number](https://www.mathplacementreview.com/arithmetic/fractions.php#mixed-number). For example: ```python get_mixed_num('18/11') # S...
apps_data_3819
# Sentence Smash Write a function that takes an array of words and smashes them together into a sentence and returns the sentence. You can ignore any need to sanitize words or add punctuation, but you should add spaces between each word. **Be careful, there shouldn't be a space at the beginning or the end of the sente...
apps_data_3820
Write a function which takes one parameter representing the dimensions of a checkered board. The board will always be square, so 5 means you will need a 5x5 board. The dark squares will be represented by a unicode white square, while the light squares will be represented by a unicode black square (the opposite colours...
apps_data_3821
The [Chinese zodiac](https://en.wikipedia.org/wiki/Chinese_zodiac) is a repeating cycle of 12 years, with each year being represented by an animal and its reputed attributes. The lunar calendar is divided into cycles of 60 years each, and each year has a combination of an animal and an element. There are 12 animals and...
apps_data_3822
For a given array whose element values are randomly picked from single-digit integers `0` to `9`, return an array with the same digit order but all `0`'s paired. Paring two `0`'s generates one `0` at the location of the first. Ex: ```python pair_zeros([0, 1, 0, 2]) # paired: ^-----^ cull second zero == [0, 1, 2...
apps_data_3823
```if:javascript `Array.prototype.length` will give you the number of top-level elements in an array. ``` ```if:ruby `Array#length` will give you the number of top-level elements in an array. ``` ```if:csharp The `Length` property of an array will give you the number of top-level elements in an array. ``` ```if:php `co...
apps_data_3824
Given a certain integer ```n, n > 0```and a number of partitions, ```k, k > 0```; we want to know the partition which has the maximum or minimum product of its terms. The function ```find_spec_partition() ```, will receive three arguments, ```n```, ```k```, and a command: ```'max' or 'min'``` The function should...
apps_data_3825
Regex Failure - Bug Fixing #2 Oh no, Timmy's received some hate mail recently but he knows better. Help Timmy fix his regex filter so he can be awesome again! import re def filter_words(phrase): return re.sub("(bad|mean|ugly|horrible|hideous)","awesome", phrase,flags=re.IGNORECASE) from re import sub def ...
apps_data_3826
Let be `n` an integer prime with `10` e.g. `7`. `1/7 = 0.142857 142857 142857 ...`. We see that the decimal part has a cycle: `142857`. The length of this cycle is `6`. In the same way: `1/11 = 0.09 09 09 ...`. Cycle length is `2`. # Task Given an integer n (n > 1), the function cycle(n) returns the length of the...
apps_data_3827
Below is a right-angled triangle: ``` |\ | \ | \ | \ o | \ h | \ | θ \ |_______\ a ``` Your challange is to write a function (```missingAngle``` in C/C#, ```missing_angle``` in Ruby), that calculates the angle θ in degrees to the nearest integer. You will be given three arguments re...
apps_data_3828
## Task To charge your mobile phone battery, do you know how much time it takes from 0% to 100%? It depends on your cell phone battery capacity and the power of the charger. A rough calculation method is: ``` 0% --> 85% (fast charge) (battery capacity(mAh) * 85%) / power of the charger(mA) 85% --> 95% (decreasing ch...
apps_data_3829
# The Invitation Most of us played with toy blocks growing up. It was fun and you learned stuff. So what else can you do but rise to the challenge when a 3-year old exclaims, "Look, I made a square!", then pointing to a pile of blocks, "Can _you_ do it?" # These Blocks Just to play along, of course we'll be viewing ...
apps_data_3830
Every natural number, ```n```, may have a prime factorization like: We define the arithmetic derivative of ```n```, ```n'``` the value of the expression: Let's do the calculation for ```n = 231525```. ``` 231525 = 3³5²7³ n' = (3*3²)*5²7³ + 3³*(2*5)*7³ + 3³*5²*(3*7²) = 231525 + 92610 + 99225 = 423360 ``` We may m...
apps_data_3831
Find the total sum of internal angles (in degrees) in an n-sided simple polygon. N will be greater than 2. def angle(n): return 180 * (n - 2) def angle(n): return (n-2)*180 angle=lambda n:(n-2)*180 def angle(n): "Sum angles in N-sided shape" return (n - 2) * 180 def angle(n): var = n-2 return...
apps_data_3832
We have an array of unique elements. A special kind of permutation is the one that has all of its elements in a different position than the original. Let's see how many of these permutations may be generated from an array of four elements. We put the original array with square brackets and the wanted permutations with...
apps_data_3833
Take 2 strings `s1` and `s2` including only letters from `a`to `z`. Return a new **sorted** string, the longest possible, containing distinct letters, - each taken only once - coming from s1 or s2. # Examples: ``` a = "xyaabbbccccdefww" b = "xxxxyyyyabklmopq" longest(a, b) -> "abcdefklmopqwxy" a = "abcdefghijklmnopqr...
apps_data_3834
Four-digit palindromes start with `[1001,1111,1221,1331,1441,1551,1551,...]` and the number at position `2` is `1111`. You will be given two numbers `a` and `b`. Your task is to return the `a-digit` palindrome at position `b` if the palindromes were arranged in increasing order. Therefore, `palin(4,2) = 1111`, bec...
apps_data_3835
Your friend Cody has to sell a lot of jam, so he applied a good 25% discount to all his merchandise. Trouble is that he mixed all the prices (initial and discounted), so now he needs your cool coding skills to filter out only the discounted prices. For example, consider this inputs: ``` "15 20 60 75 80 100" "9 9 12 1...
apps_data_3836
Create a function that takes a number and finds the factors of it, listing them in **descending** order in an **array**. If the parameter is not an integer or less than 1, return `-1`. In C# return an empty array. For Example: `factors(54)` should return `[54, 27, 18, 9, 6, 3, 2, 1]` def factors(x): if not isins...
apps_data_3837
If this challenge is too easy for you, check out: https://www.codewars.com/kata/5cc89c182777b00001b3e6a2 ___ Upside-Down Pyramid Addition is the process of taking a list of numbers and consecutively adding them together until you reach one number. When given the numbers `2, 1, 1` the following process occurs: ``` ...
apps_data_3838
There is a house with 4 levels. In that house there is an elevator. You can program this elevator to go up or down, depending on what button the user touches inside the elevator. Valid levels must be only these numbers: `0,1,2,3` Valid buttons must be only these strings: `'0','1','2','3'` Possible return values are...
apps_data_3839
A new school year is approaching, which also means students will be taking tests. The tests in this kata are to be graded in different ways. A certain number of points will be given for each correct answer and a certain number of points will be deducted for each incorrect answer. For ommitted answers, points will eit...
apps_data_3840
## **Task** You are given a positive integer (`n`), and your task is to find the largest number **less than** `n`, which can be written in the form `a**b`, where `a` can be any non-negative integer and `b` is an integer greater than or equal to `2`. Try not to make the code time out :) The input range is from `1` to ...
apps_data_3841
Given a hash of letters and the number of times they occur, recreate all of the possible anagram combinations that could be created using all of the letters, sorted alphabetically. The inputs will never include numbers, spaces or any special characters, only lowercase letters a-z. E.g. get_words({2=>["a"], 1=>["b", "...
apps_data_3842
Your job is to write a function that takes a string and a maximum number of characters per line and then inserts line breaks as necessary so that no line in the resulting string is longer than the specified limit. If possible, line breaks should not split words. However, if a single word is longer than the limit, it o...
apps_data_3843
For encrypting strings this region of chars is given (in this order!): * all letters (ascending, first all UpperCase, then all LowerCase) * all digits (ascending) * the following chars: `.,:;-?! '()$%&"` These are 77 chars! (This region is zero-based.) Write two methods: ```python def encrypt(text) def decrypt(enc...
apps_data_3844
*** Nova polynomial from roots*** This kata is from a series on polynomial handling. ( [#1](http://www.codewars.com/kata/nova-polynomial-1-add-1) [#2](http://www.codewars.com/kata/570eb07e127ad107270005fe) [#3](http://www.codewars.com/kata/5714041e8807940ff3001140 ) [#4](http://www.codewars.com/kata/571a2e2df24b...
apps_data_3845
Calculate the product of all elements in an array. ```if:csharp If the array is *null*, you should throw `ArgumentNullException` and if the array is empty, you should throw `InvalidOperationException`. As a challenge, try writing your method in just one line of code. It's possible to have only 36 characters within you...
apps_data_3846
_This kata is based on [Project Euler Problem 546](https://projecteuler.net/problem=546)_ # Objective Given the recursive sequence fk(n) = ∑ i = 0 n fk(floor(i / k)) where fk(0) = 1 Define a function `f` that takes arguments `k` and `n` and returns the nth term in the sequence fk ## Examples `f(2, 3)` = ...
apps_data_3847
In computer science, cycle detection is the algorithmic problem of finding a cycle in a sequence of iterated function values. For any function ƒ, and any initial value x0 in S, the sequence of iterated function values x0,x1=f(x0), x2=f(x1), ...,xi=f(x{i-1}),... may eventually use the same value twice under some ...
apps_data_3848
You are given three integers in the range [0-99]. You must determine if any ordering of the numbers forms a date from the 20th century. - If no ordering forms a date, return the string `"invalid"`. - If multiple distinct orderings form dates, return the string `"ambiguous"`. - If only one ordering forms a date, retu...
apps_data_3849
Modify the spacify function so that it returns the given string with spaces inserted between each character. ```python spacify("hello world") # returns "h e l l o w o r l d" ``` spacify = " ".join def spacify(string): return " ".join(string) def spacify(string): return ' '.join(list(string)) def spacify(...
apps_data_3850
You were given a string of integer temperature values. Create a function `close_to_zero(t)` and return the closest value to 0 or `0` if the string is empty. If two numbers are equally close to zero, return the positive integer. def close_to_zero(t): if len(t)==0: return (0) x=t.split(" ") l=[] ...
apps_data_3851
Simple interest on a loan is calculated by simply taking the initial amount (the principal, p) and multiplying it by a rate of interest (r) and the number of time periods (n). Compound interest is calculated by adding the interest after each time period to the amount owed, then calculating the next interest payment b...
apps_data_3852
```if-not:sql Implement a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one). ``` ```if:sql Given a database of first and last IPv4 addresses, calculate the number of addresses between them (including the first one, excluding th...
apps_data_3853
Your goal is to create a function to format a number given a template; if the number is not present, use the digits `1234567890` to fill in the spaces. A few rules: * the template might consist of other numbers, special characters or the like: you need to replace only alphabetical characters (both lower- and uppercas...
apps_data_3854
## Story Your company migrated the last 20 years of it's *very important data* to a new platform, in multiple phases. However, something went wrong: some of the essential time-stamps were messed up! It looks like that some servers were set to use the `dd/mm/yyyy` date format, while others were using the `mm/dd/yyyy` f...
apps_data_3855
You're on your way to the market when you hear beautiful music coming from a nearby street performer. The notes come together like you wouln't believe as the musician puts together patterns of tunes. As you wonder what kind of algorithm you could use to shift octaves by 8 pitches or something silly like that, it dawns ...
apps_data_3856
The prime number sequence starts with: `2,3,5,7,11,13,17,19...`. Notice that `2` is in position `one`. `3` occupies position `two`, which is a prime-numbered position. Similarly, `5`, `11` and `17` also occupy prime-numbered positions. We shall call primes such as `3,5,11,17` dominant primes because they occupy prime...
apps_data_3857
###BACKGROUND: Jacob recently decided to get healthy and lose some weight. He did a lot of reading and research and after focusing on steady exercise and a healthy diet for several months, was able to shed over 50 pounds! Now he wants to share his success, and has decided to tell his friends and family how much weight ...
apps_data_3858
Unscramble the eggs. The string given to your function has had an "egg" inserted directly after each consonant. You need to return the string before it became eggcoded. ## Example Kata is supposed to be for beginners to practice regular expressions, so commenting would be appreciated. def unscramble_eggs(word): ...
apps_data_3859
```if-not:swift Create a method that takes an array/list as an input, and outputs the index at which the sole odd number is located. This method should work with arrays with negative numbers. If there are no odd numbers in the array, then the method should output `-1`. ``` ```if:swift reate a function `oddOne` that ta...
apps_data_3860
# Task There are `n` bears in the orchard and they picked a lot of apples. They distribute apples like this: ``` The first bear divided the apple into n piles, each with the same number. leaving an apple at last, and the apple was thrown away. Then he took 1 pile and left the n-1 pile. The second bear divided the ...
apps_data_3861
# The President's phone is broken He is not very happy. The only letters still working are uppercase ```E```, ```F```, ```I```, ```R```, ```U```, ```Y```. An angry tweet is sent to the department responsible for presidential phone maintenance. # Kata Task Decipher the tweet by looking for words with known meaning...
apps_data_3862
Your back at your newly acquired decrypting job for the secret organization when a new assignment comes in. Apparently the enemy has been communicating using a device they call "The Mirror". It is a rudimentary device with encrypts the message by switching its letter with its mirror opposite (A => Z), (B => Y), (C ...
apps_data_3863
# Task John is playing a RPG game. The initial attack value of the player is `x`. The player will face a crowd of monsters. Each monster has different defense value. If the monster's defense value is less than or equal to the player's attack value, the player can easily defeat the monster, and the player's attack val...
apps_data_3864
Take the following IPv4 address: `128.32.10.1` This address has 4 octets where each octet is a single byte (or 8 bits). * 1st octet `128` has the binary representation: `10000000` * 2nd octet `32` has the binary representation: `00100000` * 3rd octet `10` has the binary representation: `00001010` * 4th octet `1` has ...
apps_data_3865
In this kata we are focusing on the Numpy python package. You must write a function called `looper` which takes three integers `start, stop and number` as input and returns a list from `start` to `stop` with `number` total values in the list. Five examples are shown below: ``` looper(1, 5, 1) = [1.0] looper(1, 5, 2) ...
apps_data_3866
Three candidates take part in a TV show. In order to decide who will take part in the final game and probably become rich, they have to roll the Wheel of Fortune! The Wheel of Fortune is divided into 20 sections, each with a number from 5 to 100 (only mulitples of 5). Each candidate can roll the wheel once or twice ...
apps_data_3867
Our fruit guy has a bag of fruit (represented as an array of strings) where some fruits are rotten. He wants to replace all the rotten pieces of fruit with fresh ones. For example, given `["apple","rottenBanana","apple"]` the replaced array should be `["apple","banana","apple"]`. Your task is to implement a method that...
apps_data_3868
Given an array (ints) of n integers, find three integers in arr such that the sum is closest to a given number (num), target. Return the sum of the three integers. You may assume that each input would have exactly one solution. Example: Note: your solution should not modify the input array. from itertools import c...
apps_data_3869
# Task Below we will define what and n-interesting polygon is and your task is to find its area for a given n. A 1-interesting polygon is just a square with a side of length 1. An n-interesting polygon is obtained by taking the n - 1-interesting polygon and appending 1-interesting polygons to its rim side by side. Y...
apps_data_3870
In this Kata, we are going to reverse a string while maintaining the spaces (if any) in their original place. For example: ``` solve("our code") = "edo cruo" -- Normal reversal without spaces is "edocruo". -- However, there is a space at index 3, so the string becomes "edo cruo" solve("your code rocks") = "skco redo...
apps_data_3871
# Task Given a binary number, we are about to do some operations on the number. Two types of operations can be here: * ['I', i, j] : Which means invert the bit from i to j (inclusive). * ['Q', i] : Answer whether the i'th bit is 0 or 1. The MSB (most significant bit) is the first bit (i.e. i = `1`). The binary numb...
apps_data_3872
Write a function that accepts two parameters, i) a string (containing a list of words) and ii) an integer (n). The function should alphabetize the list based on the nth letter of each word. The letters should be compared case-insensitive. If both letters are the same, order them normally (lexicographically), again, c...
apps_data_3873
Related to MrZizoScream's Product Array kata. You might want to solve that one first :) ```if:javascript **Note:** Node 10 has now been enabled, and you can now use its BigInt capabilities if you wish, though your resulting array must still contain strings (e.g. "99999999999", not 9999999999n) Pre-node 10: You will n...
apps_data_3874
#Sorting on planet Twisted-3-7 There is a planet... in a galaxy far far away. It is exactly like our planet, but it has one difference: #The values of the digits 3 and 7 are twisted. Our 3 means 7 on the planet Twisted-3-7. And 7 means 3. Your task is to create a method, that can sort an array the way it would be sor...
apps_data_3875
# # Task: * #### Complete the pattern, using the special character ```■ □``` * #### In this kata, we draw some histogram of the sound performance of ups and downs. # # Rules: - parameter ```waves``` The value of sound waves, an array of number, all number in array >=0. - return a string, ```■``` represent...
apps_data_3876
Your task is to write function ```findSum```. Upto and including ```n```, this function will return the sum of all multiples of 3 and 5. For example: ```findSum(5)``` should return 8 (3 + 5) ```findSum(10)``` should return 33 (3 + 5 + 6 + 9 + 10) def find(n): return sum(e for e in range(1, n+1) if e % 3 == 0 o...
apps_data_3877
The T9 typing predictor helps with suggestions for possible word combinations on an old-style numeric keypad phone. Each digit in the keypad (2-9) represents a group of 3-4 letters. To type a letter, press once the key which corresponds to the letter group that contains the required letter. Typing words is done by typi...
apps_data_3878
Adapted from here, with less terrible instructions and a couple tweaks. Two kangaroos are jumping on a line. They start out at different points on the line, and jump in the same direction at different speeds. Your task is to determine whether or not they'll ever land in the same spot at the same time (you'll just have...
apps_data_3879
You love coffee and want to know what beans you can afford to buy it. The first argument to your search function will be a number which represents your budget. The second argument will be an array of coffee bean prices. Your 'search' function should return the stores that sell coffee within your budget. The search...
apps_data_3880
The concept of "[smooth number](https://en.wikipedia.org/wiki/Smooth_number)" is applied to all those numbers whose prime factors are lesser than or equal to `7`: `60` is a smooth number (`2 * 2 * 3 * 5`), `111` is not (`3 * 37`). More specifically, smooth numbers are classified by their highest prime factor and your ...
apps_data_3881
The central dogma of molecular biology is that DNA is transcribed into RNA, which is then tranlsated into protein. RNA, like DNA, is a long strand of nucleic acids held together by a sugar backbone (ribose in this case). Each segment of three bases is called a codon. Molecular machines called ribosomes translate the RN...
apps_data_3882
# Sort an array by value and index Your task is to sort an array of integer numbers by the product of the value and the index of the positions. For sorting the index starts at 1, NOT at 0! The sorting has to be ascending. The array will never be null and will always contain numbers. Example: ``` Input: 23, 2, 3, 4, ...
apps_data_3883
If we alternate the vowels and consonants in the string `"have"`, we get the following list, arranged alphabetically: `['ahev', 'aveh', 'ehav', 'evah', 'vahe', 'veha']`. These are the only possibilities in which vowels and consonants are alternated. The first element, `ahev`, is alphabetically lowest. Given a string:...
apps_data_3884
# RegExp Fun #1 - When I miss few days of gym ## Disclaimer The background story of this Kata is 100% fiction. Any resemblance to real people or real events is **nothing more than a coincidence** and should be regarded as such. ## Background Story You are a person who loves to go to the gym everyday with the squad...
apps_data_3885
The palindromic number `595` is interesting because it can be written as the sum of consecutive squares: `6^2 + 7^2 + 8^2 + 9^2 + 10^2 + 11^2 + 12^2 = 595`. There are exactly eleven palindromes below one-thousand that can be written as consecutive square sums. Note that `1 = 0^2 + 1^2` has not been included as this pr...
apps_data_3886
In this Kata, you will be given an integer array and your task is to return the sum of elements occupying prime-numbered indices. ~~~if-not:fortran The first element of the array is at index `0`. ~~~ ~~~if:fortran The first element of an array is at index `1`. ~~~ Good luck! If you like this Kata, try: [Dominan...
apps_data_3887
< PREVIOUS KATA NEXT KATA > ###Task: You have to write a function `pattern` which returns the following Pattern(See Examples) upto (3n-2) rows, where n is parameter. * Note:`Returning` the pattern is not the same as `Printing` the pattern. ####Rules/Note: * The pattern should be created using only unit digits. * I...
apps_data_3888
Note : Issues Fixed with python 2.7.6 , Use any one you like :D , ( Thanks to Time , time , time . Your task is to write a function that will return the degrees on a analog clock from a digital time that is passed in as parameter . The digital time is type string and will be in the format 00:00 . You also need to ret...
apps_data_3889
You've got a bunch of textual data with embedded phone numbers. Write a function `area_code()` that finds and returns just the area code portion of the phone number. ```python >>> message = "The supplier's phone number is (555) 867-5309" >>> area_code(message) '555' ``` The returned area code should be a string, not a ...
apps_data_3890
Let's say that in a hypothetical platform that resembles Codewars there is a clan with 2 warriors. The 2nd one in ranking (lets call him **D**) wants to at least reach the honor score of his ally (lets call her **M**). *(Let's say that there is no antagonism here, he just wants to prove his ally that she should be pro...
apps_data_3891
The new £5 notes have been recently released in the UK and they've certainly became a sensation! Even those of us who haven't been carrying any cash around for a while, having given in to the convenience of cards, suddenly like to have some of these in their purses and pockets. But how many of them could you get with w...
apps_data_3892
Create a function that takes a number as an argument and returns a grade based on that number. Score | Grade -----------------------------------------|----- Anything greater than 1 or less than 0.6 | "F" 0.9 or greater | "A" 0.8 or greater ...
apps_data_3893
Create a function named `divisors`/`Divisors` that takes an integer `n > 1` and returns an array with all of the integer's divisors(except for 1 and the number itself), from smallest to largest. If the number is prime return the string '(integer) is prime' (`null` in C#) (use `Either String a` in Haskell and `Result, S...
apps_data_3894
In this Kata, you will be given a string that may have mixed uppercase and lowercase letters and your task is to convert that string to either lowercase only or uppercase only based on: * make as few changes as possible. * if the string contains equal number of uppercase and lowercase letters, convert the string to ...
apps_data_3895
Write a function that receives two strings and returns n, where n is equal to the number of characters we should shift the first string forward to match the second. For instance, take the strings "fatigue" and "tiguefa". In this case, the first string has been rotated 5 characters forward to produce the second string,...
apps_data_3896
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Finish the solution so that it returns the sum of all the multiples of 3 or 5 **below** the number passed in. > Note: If the number is a multiple of **both** 3 and 5, only count it *once*...
apps_data_3897
Jack and Jill are playing a game. They have balls numbered from `0` to `n - 1`. Jack looks the other way and asks Jill to reverse the position of the balls, for instance, to change the order from say, `0,1,2,3` to `3,2,1,0`. He further asks Jill to reverse the position of the balls `n` times, each time starting from on...
apps_data_3898
Convert DD (decimal degrees) position to DMS (degrees, minutes, seconds). ##### Inputs: `dd_lat` and `dd_lon` 2 strings representing the latitude and the longitude in degree -i.e. 2 floats included in [-90, 90] and [-180, 180]. Note that latitude 0 is north, longitude 0 is east. ##### Outputs: A tuple of DMS latitude...
apps_data_3899
Your Goal is to create a function that takes two strings, a guess and a phone number. Based on the guess, the function should display a portion of the phone number: guess_my_number('052', '123-451-2345') would return the string: '#2#-#5#-2##5' or guess_my_number('142', '123-451-2345') ...