id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_3900
A **Seven Segment Display** is an electronic display device, used to display decimal or hexadecimal numerals. It involves seven led segments that are lit in specific combinations to represent a specific numeral. An example of each combination is shown below: ![seven segment display](https://upload.wikimedia.org/wikipe...
apps_data_3901
In this Kata, you will be given a ```number```, two indexes (```index1``` and ```index2```) and a ```digit``` to look for. Your task will be to check if the ```digit``` exists in the ```number```, within the ```indexes``` given. Be careful, the ```index2``` is not necessarily more than the ```index1```. ``` index1 ...
apps_data_3902
The purpose of this kata is to work out just how many bottles of duty free whiskey you would have to buy such that the saving over the normal high street price would effectively cover the cost of your holiday. You will be given the high street price (normPrice), the duty free discount (discount) and the cost of the h...
apps_data_3903
In Russia, there is an army-purposed station named UVB-76 or "Buzzer" (see also https://en.wikipedia.org/wiki/UVB-76). Most of time specific "buzz" noise is being broadcasted, but on very rare occasions, the buzzer signal is interrupted and a voice transmission in Russian takes place. Transmitted messages have always t...
apps_data_3904
Same as [the original](https://www.codewars.com/kata/simple-fun-number-258-is-divisible-by-6) (same rules, really, go there for example and I strongly recommend completing it first), but with more than one asterisk (but always at least one). For example, `"*2"` should return `["12", "42", "72"]`. Similarly, `"*2*"` s...
apps_data_3905
In this Kata, you will be given a string of numbers in sequence and your task will be to return the missing number. If there is no number missing or there is an error in the sequence, return `-1`. For example: ```Haskell missing("123567") = 4 missing("899091939495") = 92 missing("9899101102") = 100 missing("599600601...
apps_data_3906
Write a function that takes an array/list of numbers and returns a number such that Explanation total([1,2,3,4,5]) => 48 1+2=3--\ 3+5 => 8 \ 2+3=5--/ \ == 8+12=>20\ ==>5+7=> 12 / \ 20+28 => 48 3+4=7--\ / == 12+16=>28/ 4+5=9--/ 7+9 => 16 / if total([1,2,3]) =...
apps_data_3907
We need you to implement a method of receiving commands over a network, processing the information and responding. Our device will send a single packet to you containing data and an instruction which you must perform before returning your reply. To keep things simple, we will be passing a single "packet" as a string....
apps_data_3908
In this Kata, you will sort elements in an array by decreasing frequency of elements. If two elements have the same frequency, sort them by increasing value. More examples in test cases. Good luck! Please also try [Simple time difference](https://www.codewars.com/kata/5b76a34ff71e5de9db0000f2) from collections i...
apps_data_3909
In recreational mathematics, a [Keith number](https://en.wikipedia.org/wiki/Keith_number) or repfigit number (short for repetitive Fibonacci-like digit) is a number in the following integer sequence: `14, 19, 28, 47, 61, 75, 197, 742, 1104, 1537, 2208, 2580, 3684, 4788, 7385, 7647, 7909, ...` (sequence A007629 in the ...
apps_data_3910
An expression is formed by taking the digits 1 to 9 in numerical order and then inserting into each gap between the numbers either a plus sign or a minus sign or neither. Your task is to write a method which takes one parameter and returns the **smallest possible number** of plus and minus signs necessary to form such...
apps_data_3911
I always thought that my old friend John was rather richer than he looked, but I never knew exactly how much money he actually had. One day (as I was plying him with questions) he said: * "Imagine I have between `m` and `n` Zloty..." (or did he say Quetzal? I can't remember!) * "If I were to buy **9** cars costing `c`...
apps_data_3912
Given an array containing only integers, add all the elements and return the binary equivalent of that sum. If the array contains any non-integer element (e.g. an object, a float, a string and so on), return false. **Note:** The sum of an empty array is zero. ```python arr2bin([1,2]) == '11' arr2bin([1,2,'a']) == Fa...
apps_data_3913
Given the current exchange rate between the USD and the EUR is 1.1363636 write a function that will accept the Curency type to be returned and a list of the amounts that need to be converted. Don't forget this is a currency so the result will need to be rounded to the second decimal. 'USD' Return format should be `'...
apps_data_3914
A zero-indexed array ```arr``` consisting of n integers is given. The dominator of array ```arr``` is the value that occurs in more than half of the elements of ```arr```. For example, consider array ```arr``` such that ```arr = [3,4,3,2,3,1,3,3]``` The dominator of ```arr``` is 3 because it occurs in 5 out of 8 elemen...
apps_data_3915
In elementary arithmetic a "carry" is a digit that is transferred from one column of digits to another column of more significant digits during a calculation algorithm. This Kata is about determining the number of carries performed during the addition of multi-digit numbers. You will receive an input string containin...
apps_data_3916
Your goal is to implement the method **meanVsMedian** which accepts an *odd-length* array of integers and returns one of the following: * 'mean' - in case **mean** value is **larger than** median value * 'median' - in case **median** value is **larger than** mean value * 'same' - in case both mean and median share the...
apps_data_3917
# Back-Story Every day I travel on the freeway. When I am more bored than usual I sometimes like to play the following counting game I made up: * As I join the freeway my count is ```0``` * Add ```1``` for every car that I overtake * Subtract ```1``` for every car that overtakes me * Stop counting when I reach my ex...
apps_data_3918
You've had a baby. Well done. Nice isn't it? Life destroying... but in a good way. Part of your new routine is lying awake at night worrying that you've either lost the baby... or that you have more than 1! Given a string of words (x), you need to calculate how many babies are in it. To count as a baby you must have...
apps_data_3919
# Task A noob programmer was given two simple tasks: sum and sort the elements of the given array `arr` = [a1, a2, ..., an]. He started with summing and did it easily, but decided to store the sum he found in some random position of the original array which was a bad idea. Now he needs to cope with the second task...
apps_data_3920
# Task The `hamming distance` between a pair of numbers is the number of binary bits that differ in their binary notation. # Example For `a = 25, b= 87`, the result should be `4` ``` 25: 00011001 87: 01010111 ``` The `hamming distance` between these two would be 4 ( the `2nd, 5th, 6th, 7th` bit ). # Input/Outpu...
apps_data_3921
Correct this code so that it takes one argument, `x`, and returns "`x` is more than zero" if `x` is positive (and nonzero), and otherwise, returns "`x` is equal to or less than zero." In both cases, replace `x` with the actual value of `x`. def corrections(x): str = "{0} is more than zero." if x > 0 else "{0} is e...
apps_data_3922
# Task You are a lonely frog. You live on an integer array. The meaning of your life is to jump and jump.. Now, here comes your new task. You are given an integer array `arr` and a positive integer `n`. You will jump following the rules below: - Your initial position at `arr[0]`. arr[0] will always be `0`. - ...
apps_data_3923
# Your Task You have a Petri dish with bacteria, and you are preparing to dive into the harsh micro-world. But, unfortunately, you don't have any microscope nearby, so you can't watch them. You know that you have `n` bacteria in the Petri dish and size of the i-th bacteria is bacteriai. Also you know intergalactic pos...
apps_data_3924
Complete the function that accepts a string parameter, and reverses each word in the string. **All** spaces in the string should be retained. ## Examples ``` "This is an example!" ==> "sihT si na !elpmaxe" "double spaces" ==> "elbuod secaps" ``` def reverse_words(str): return ' '.join(s[::-1] for s in str....
apps_data_3925
# Task John and Alice have an appointment today. In the morning, John starts from (`0,0`) and goes to the place (`a,b`) where he is dating. Unfortunately, John had no sense of direction at all, so he moved 1 step in a random direction(up, down, left or right) each time. For example, if John at (x,y), next step he ma...
apps_data_3926
While surfing in web I found interesting math problem called "Always perfect". That means if you add 1 to the product of four consecutive numbers the answer is ALWAYS a perfect square. For example we have: 1,2,3,4 and the product will be 1X2X3X4=24. If we add 1 to the product that would become 25, since the result numb...
apps_data_3927
Some numbers have funny properties. For example: > 89 --> 8¹ + 9² = 89 * 1 > 695 --> 6² + 9³ + 5⁴= 1390 = 695 * 2 > 46288 --> 4³ + 6⁴+ 2⁵ + 8⁶ + 8⁷ = 2360688 = 46288 * 51 Given a positive integer n written as abcd... (a, b, c, d... being digits) and a positive integer p - we want to find a positive integer k, if i...
apps_data_3928
You can print your name on a billboard ad. Find out how much it will cost you. Each letter has a default price of £30, but that can be different if you are given 2 parameters instead of 1. You can not use multiplier "*" operator. If your name would be Jeong-Ho Aristotelis, ad would cost £600. 20 leters * 30 = 600 (Sp...
apps_data_3929
You need to write a function that reverses the words in a given string. A word can also fit an empty string. If this is not clear enough, here are some examples: As the input may have trailing spaces, you will also need to ignore unneccesary whitespace. ```python reverse('Hello World') == 'World Hello' reverse('Hi Th...
apps_data_3930
You start with a value in dollar form, e.g. $5.00. You must convert this value to a string in which the value is said, like '5 dollars' for example. This should account for ones, cents, zeroes, and negative values. Here are some examples: ```python dollar_to_speech('$0.00') == '0 dollars.' dollar_to_speech('$1.00') == ...
apps_data_3931
# 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 settlements, roads, and cities or buy a development. Other kata about this game can be found [here](https://www....
apps_data_3932
# Story&Task The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all houses in the city were built in one row. Let's enumerate all the houses from left to right, starting with 0. A house is considered to be luxurious if the number of floors in it is strictl...
apps_data_3933
# Welcome to the Codewars Bar! Codewars Bar recommends you drink 1 glass of water per standard drink so you're not hungover tomorrow morning. Your fellow coders have bought you several drinks tonight in the form of a string. Return a string suggesting how many glasses of water you should drink to not be hungover. ##...
apps_data_3934
## Task: You have to write a function `pattern` which returns the following Pattern (See Pattern & Examples) upto `n` number of rows. * Note: `Returning` the pattern is not the same as `Printing` the pattern. ### Rules/Note: * If `n < 1` then it should return "" i.e. empty string. * There are `no whitespaces` in the...
apps_data_3935
`{a, e, i, o, u, A, E, I, O, U}` Natural Language Understanding is the subdomain of Natural Language Processing where people used to design AI based applications have ability to understand the human languages. HashInclude Speech Processing team has a project named Virtual Assistant. For this project they appointed you...
apps_data_3936
# History This kata is a sequel of my [Mixbonacci](https://www.codewars.com/kata/mixbonacci/python) kata. Zozonacci is a special integer sequence named after [**ZozoFouchtra**](https://www.codewars.com/users/ZozoFouchtra), who came up with this kata idea in the [Mixbonacci discussion](https://www.codewars.com/kata/mix...
apps_data_3937
We want to find the numbers higher or equal than 1000 that the sum of every four consecutives digits cannot be higher than a certain given value. If the number is ``` num = d1d2d3d4d5d6 ```, and the maximum sum of 4 contiguous digits is ```maxSum```, then: ```python d1 + d2 + d3 + d4 <= maxSum d2 + d3 + d4 + d5 <= maxS...
apps_data_3938
Assume you are creating a webshop and you would like to help the user in the search. You have products with brands, prices and name. You have the history of opened products (the most recently opened being the first item). Your task is to create a list of brands ordered by popularity, if two brands have the same popula...
apps_data_3939
# Rock Paper Scissors Let's play! You have to return which player won! In case of a draw return `Draw!`. Examples: ![rockpaperscissors](http://i.imgur.com/aimOQVX.png) def rps(p1, p2): beats = {'rock': 'scissors', 'scissors': 'paper', 'paper': 'rock'} if beats[p1] == p2: return "Player 1 won!" i...
apps_data_3940
Christmas is coming, and Santa has a long list to go through, to find who deserves presents for the big day. Go through a list of children, and return a list containing every child who appeared on Santa's list. Do not add any child more than once. Output should be sorted. ~~~if:java For java, use Lists. ~~~ Comparison...
apps_data_3941
FizzBuzz is often one of the first programming puzzles people learn. Now undo it with reverse FizzBuzz! Write a function that accepts a string, which will always be a valid section of FizzBuzz. Your function must return an array that contains the numbers in order to generate the given section of FizzBuzz. Notes: - If...
apps_data_3942
There is enough money available on ATM in nominal value 10, 20, 50, 100, 200 and 500 dollars. You are given money in nominal value of `n` with `1<=n<=1500`. Try to find minimal number of notes that must be used to repay in dollars, or output -1 if it is impossible. Good Luck!!! def solve(n): if n%10: return -1 ...
apps_data_3943
# Task: Based on the received dimensions, `a` and `b`, of an ellipse, calculare its area and perimeter. ## Example: ```python Input: ellipse(5,2) Output: "Area: 31.4, perimeter: 23.1" ``` **Note:** The perimeter approximation formula you should use: `π * (3/2(a+b) - sqrt(ab))` ___ ## Have fun :) from math import...
apps_data_3944
Your task is to return the sum of Triangular Numbers up-to-and-including the `nth` Triangular Number. Triangular Number: "any of the series of numbers (1, 3, 6, 10, 15, etc.) obtained by continued summation of the natural numbers 1, 2, 3, 4, 5, etc." ``` [01] 02 [03] 04 05 [06] 07 08 09 [10] 11 12 13 14 [15] 16 17 18...
apps_data_3945
Student A and student B are giving each other test answers during a test. They don't want to be caught so they are sending each other coded messages. Student A is sending student B the message: `Answer to Number 5 Part b`. He starts of with a square grid (in this example the grid = 5x5). He writes the message do...
apps_data_3946
Your friend Rick is trying to send you a message, but he is concerned that it would get intercepted by his partner. He came up with a solution: 1) Add digits in random places within the message. 2) Split the resulting message in two. He wrote down every second character on one page, and the remaining ones on another....
apps_data_3947
Welcome. In this kata, you are asked to square every digit of a number and concatenate them. For example, if we run 9119 through the function, 811181 will come out, because 9^(2) is 81 and 1^(2) is 1. **Note:** The function accepts an integer and returns an integer def square_digits(num): ret = "" for x in s...
apps_data_3948
Given an array, return the reversed version of the array (a different kind of reverse though), you reverse portions of the array, you'll be given a length argument which represents the length of each portion you are to reverse. E.g if after reversing some portions of the array and the length of the remaining port...
apps_data_3949
Complete the function, which calculates how much you need to tip based on the total amount of the bill and the service. You need to consider the following ratings: - Terrible: tip 0% - Poor: tip 5% - Good: tip 10% - Great: tip 15% - Excellent: tip 20% The rating is **case insensitive** (so "great" = "GREAT"). If an...
apps_data_3950
We are interested in obtaining two scores from a given integer: **First score**: The sum of all the integers obtained from the power set of the digits of the given integer that have the same order E.g: ``` integer = 1234 ---> (1 + 2 + 3 + 4) + (12 + 13 + 14 + 23 + 24 + 34) + (123 + 124 + 134 + 234) + 1234 = 10 + 12...
apps_data_3951
### Count the number of Duplicates Write a function that will return the count of **distinct case-insensitive** alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits. ### Ex...
apps_data_3952
The [half-life](https://en.wikipedia.org/wiki/Half-life) of a radioactive substance is the time it takes (on average) for one-half of its atoms to undergo radioactive decay. # Task Overview Given the initial quantity of a radioactive substance, the quantity remaining after a given period of time, and the period of tim...
apps_data_3953
#Detail [Countdown](https://en.wikipedia.org/wiki/Countdown_(game_show) is a British game show with number and word puzzles. The letters round consists of the contestant picking 9 shuffled letters - either picking from the vowel pile or the consonant pile. The contestants are given 30 seconds to try to come up with th...
apps_data_3954
# Task A lock has `n` buttons in it, numbered from `1 to n`. To open the lock, you have to press all buttons in some order, i.e. a key to the lock is a permutation of the first `n` integers. If you push the right button in the right order, it will be pressed into the lock. Otherwise all pressed buttons will pop out. W...
apps_data_3955
Write a function which outputs the positions of matching bracket pairs. The output should be a dictionary with keys the positions of the open brackets '(' and values the corresponding positions of the closing brackets ')'. For example: input = "(first)and(second)" should return {0:6, 10:17} If brackets cannot be pair...
apps_data_3956
# Task Your task is to sort the characters in a string according to the following rules: ``` - Rule1: English alphabets are arranged from A to Z, case insensitive. ie. "Type" --> "epTy" - Rule2: If the uppercase and lowercase of an English alphabet exist at the same time, they are arranged in the order of oringal ...
apps_data_3957
Implement a function which behaves like the 'uniq -c' command in UNIX. It takes as input a sequence and returns a sequence in which all duplicate elements following each other have been reduced to one instance together with the number of times a duplicate elements occurred in the original array. Example: ```python ...
apps_data_3958
Leonardo Fibonacci in a rare portrait of his younger days I assume you are all familiar with the famous Fibonacci sequence, having to get each number as the sum of the previous two (and typically starting with either `[0,1]` or `[1,1]` as the first numbers). While there are plenty of variation on it ([including](http...
apps_data_3959
>When no more interesting kata can be resolved, I just choose to create the new kata, to solve their own, to enjoy the process --myjinxin2015 said # Description: ```if:javascript Given an array `arr` that contains some integers(positive, negative or 0), and a `range` list such as `[[start1,end1],[start2,end2],...]`,...
apps_data_3960
Your task in this Kata is to emulate text justify right in monospace font. You will be given a single-lined text and the expected justification width. The longest word will never be greater than this width. Here are the rules: - Use spaces to fill in the gaps on the left side of the words. - Each line should contain ...
apps_data_3961
## Debugging sayHello function The starship Enterprise has run into some problem when creating a program to greet everyone as they come aboard. It is your job to fix the code and get the program working again! Example output: ``` Hello, Mr. Spock ``` def say_hello(name): return f"Hello, {name}" def say_hello(n...
apps_data_3962
You want to build a standard house of cards, but you don't know how many cards you will need. Write a program which will count the minimal number of cards according to the number of floors you want to have. For example, if you want a one floor house, you will need 7 of them (two pairs of two cards on the base floor, on...
apps_data_3963
Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number. (A proper divisor of a number is a positive factor of that number other than the number itself. For example, the proper divisors of 6 are 1, 2, and 3.) For example, the smallest pair of amic...
apps_data_3964
# Task Given an array `arr`, find the rank of the element at the ith position. The `rank` of the arr[i] is a value equal to the number of elements `less than or equal to` arr[i] standing before arr[i], plus the number of elements `less than` arr[i] standing after arr[i]. # Example For `arr = [2,1,2,1,2], i = 2`, ...
apps_data_3965
Write a method that returns true if a given parameter is a power of 4, and false if it's not. If parameter is not an Integer (eg String, Array) method should return false as well. (In C# Integer means all integer Types like Int16,Int32,.....) ### Examples ```python isPowerOf4 1024 #should return True isPowerOf4 102...
apps_data_3966
Complete the solution so that it returns the number of times the search_text is found within the full_text. Usage example: def solution(full_text, search_text): return full_text.count(search_text) solution = str.count import re def solution(full_text, search_text): return len(re.findall(r'(' + search_text ...
apps_data_3967
An eviternity number is a number which: * contains only digits 8, 5 and 3, and * the count of the digit `8` >= count of digit `5` >= count of digit `3`. The first few eviternity numbers are as follows. ```Haskell [8, 58, 85, 88, 358, 385, 538, 583, 588, 835, 853, 858, 885, 888] ``` You will be given two integers, `...
apps_data_3968
You'll be given a list of two strings, and each will contain exactly one colon (`":"`) in the middle (but not at beginning or end). The length of the strings, before and after the colon, are random. Your job is to return a list of two strings (in the same order as the original list), but with the characters after each...
apps_data_3969
Adding tip to a restaurant bill in a graceful way can be tricky, thats why you need make a function for it. The function will receive the restaurant bill (always a positive number) as an argument. You need to 1) **add at least 15%** in tip, 2) round that number up to an *elegant* value and 3) return it. What is an *e...
apps_data_3970
Given a triangle of consecutive odd numbers: ``` 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 ... ``` find the triangle's row knowing its index (the rows are 1-indexed), e.g.: ``` odd_row(1) == [1] odd_row(2) == [3, 5] odd_row(3) == [7, 9, 11] ``` **...
apps_data_3971
# Definition A **_Tidy number_** *is a number whose* **_digits are in non-decreasing order_**. ___ # Task **_Given_** a number, **_Find if it is Tidy or not_** . ____ # Warm-up (Highly recommended) # [Playing With Numbers Series](https://www.codewars.com/collections/playing-with-numbers) ___ # Notes * **_Num...
apps_data_3972
You might know some pretty large perfect squares. But what about the NEXT one? Complete the `findNextSquare` method that finds the next integral perfect square after the one passed as a parameter. Recall that an integral perfect square is an integer n such that sqrt(n) is also an integer. If the parameter is itse...
apps_data_3973
It's pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string. You don't have to worry with strings with less than two characters. def remove_char(s): return s[1 : -1] def remove_char(s): return '' if len...
apps_data_3974
Write a function that returns the number of '2's in the factorization of a number. For example, ```python two_count(24) ``` should return 3, since the factorization of 24 is 2^3 x 3 ```python two_count(17280) ``` should return 7, since the factorization of 17280 is 2^7 x 5 x 3^3 The number passed to two_count (twoC...
apps_data_3975
#Find the missing letter Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array. You will always get an valid array. And it will be always exactly one letter be missing. The length of the array will always be at least 2. The array will always c...
apps_data_3976
Find the last element of the given argument(s). ## Examples ```python last([1, 2, 3, 4]) ==> 4 last("xyz") ==> "z" last(1, 2, 3, 4) ==> 4 ``` In **javascript** and **CoffeeScript** a **list** will be an `array`, a `string` or the list of `arguments`. (courtesy of [haskell.org](http://www.haskell.org/haske...
apps_data_3977
Cluster analysis - Unweighted pair-group average Clustering is a task of grouping a set of objects in such a way that the objects in the same class are similar to each other and the objects in different classes are distinct. Cluster analysis is employed in many fields such as machine learning, pattern recognition, ima...
apps_data_3978
This function should test if the `factor` is a factor of `base`. Return `true` if it is a factor or `false` if it is not. ## About factors Factors are numbers you can multiply together to get another number. 2 and 3 are factors of 6 because: `2 * 3 = 6` - You can find a factor by dividing numbers. If the remainder ...
apps_data_3979
You have two arrays in this kata, every array contain only unique elements. Your task is to calculate number of elements in first array which also are in second array. def match_arrays(v, r): return sum(x in r for x in v) # DON'T remove verbose = False # set to True to diplay arrays being tested in the random tes...
apps_data_3980
The aim of this Kata is to write a function which will reverse the case of all consecutive duplicate letters in a string. That is, any letters that occur one after the other and are identical. If the duplicate letters are lowercase then they must be set to uppercase, and if they are uppercase then they need to be cha...
apps_data_3981
In your class, you have started lessons about "arithmetic progression". Because you are also a programmer, you have decided to write a function. This function, arithmetic_sequence_sum(a, r, n), should return the sum of the first (n) elements of a sequence in which each element is the sum of the given integer (a), and ...
apps_data_3982
You are the "computer expert" of a local Athletic Association (C.A.A.). Many teams of runners come to compete. Each time you get a string of all race results of every team who has run. For example here is a string showing the individual results of a team of 5 runners: ` "01|15|59, 1|47|6, 01|17|20, 1|32|34, 2|3|17" `...
apps_data_3983
If you have completed the Tribonacci sequence kata, you would know by now that mister Fibonacci has at least a bigger brother. If not, give it a quick look to get how things work. Well, time to expand the family a little more: think of a Quadribonacci starting with a signature of 4 elements and each following element ...
apps_data_3984
If you like Taco Bell, you will be familiar with their signature doritos locos taco. They're very good. Why can't everything be a taco? We're going to attempt that here, turning every word we find into the taco bell recipe with each ingredient. We want to input a word as a string, and return a list representing tha...
apps_data_3985
You are going to be given an array of integers. Your job is to take that array and find an index N where the sum of the integers to the left of N is equal to the sum of the integers to the right of N. If there is no index that would make this happen, return `-1`. __For example:__ Let's say you are given the array `{1...
apps_data_3986
We need to write some code to return the original price of a product, the return type must be of type decimal and the number must be rounded to two decimal places. We will be given the sale price (discounted price), and the sale percentage, our job is to figure out the original price. ### For example: Given an item...
apps_data_3987
Write a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Just like the name of this Kata). Strings passed in will consist of only letters and spaces. Spaces will be included only when more than one word is present. Examples: spinWords( ...
apps_data_3988
[Run-length encoding](http://en.wikipedia.org/wiki/Run-length_encoding) (RLE) is a very simple form of lossless data compression in which runs of data are stored as a single data value and count. A simple form of RLE would encode the string `"AAABBBCCCD"` as `"3A3B3C1D"` meaning, first there are `3 A`, then `3 B`, the...
apps_data_3989
## The galactic games have begun! It's the galactic games! Beings of all worlds come together to compete in several interesting sports, like nroogring, fredling and buzzing (the beefolks love the last one). However, there's also the traditional marathon run. Unfortunately, there have been cheaters in the last years, ...
apps_data_3990
This function takes two numbers as parameters, the first number being the coefficient, and the second number being the exponent. Your function should multiply the two numbers, and then subtract 1 from the exponent. Then, it has to print out an expression (like 28x^7). `"^1"` should not be truncated when exponent = 2. ...
apps_data_3991
Complete the method which returns the number which is most frequent in the given input array. If there is a tie for most frequent number, return the largest number among them. Note: no empty arrays will be given. ## Examples ``` [12, 10, 8, 12, 7, 6, 4, 10, 12] --> 12 [12, 10, 8, 12, 7, 6, 4, 10, 12, ...
apps_data_3992
A happy number is a number defined by the following process: starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this pro...
apps_data_3993
Given an array, return the difference between the count of even numbers and the count of odd numbers. `0` will be considered an even number. ``` For example: solve([0,1,2,3]) = 0 because there are two even numbers and two odd numbers. Even - Odd = 2 - 2 = 0. ``` Let's now add two letters to the last example: ``` ...
apps_data_3994
Two Joggers === Description --- Bob and Charles are meeting for their weekly jogging tour. They both start at the same spot called "Start" and they each run a different lap, which may (or may not) vary in length. Since they know each other for a long time already, they both run at the exact same speed. Illustration -...
apps_data_3995
Everybody knows the classic ["half your age plus seven"](https://en.wikipedia.org/wiki/Age_disparity_in_sexual_relationships#The_.22half-your-age-plus-seven.22_rule) dating rule that a lot of people follow (including myself). It's the 'recommended' age range in which to date someone. ```minimum age <= your age <= ...
apps_data_3996
Write a method `alternate_sq_sum()` (JS: `alternateSqSum` ) that takes an array of integers as input and finds the sum of squares of the elements at even positions (*i.e.,* 2nd, 4th, *etc.*) plus the sum of the rest of the elements at odd position. NOTE: The values at even *position* need to be squared. For a language...
apps_data_3997
Consider the string `"1 2 36 4 8"`. Lets take pairs of these numbers, concatenate each pair and determine how many of them of divisible by `k`. ```Pearl If k = 3, we get following numbers ['12', '18', '21', '24', '42', '48', '81', '84'], all divisible by 3. Note: -- 21 and 12 are different pairs. -- Elements mus...
apps_data_3998
Write the following function: ```python def area_of_polygon_inside_circle(circle_radius, number_of_sides): ``` It should calculate the area of a regular polygon of `numberOfSides`, `number-of-sides`, or `number_of_sides` sides inside a circle of radius `circleRadius`, `circle-radius`, or `circle_radius` which passes ...
apps_data_3999
Your job is to return the volume of a cup when given the diameter of the top, the diameter of the bottom and the height. You know that there is a steady gradient from the top to the bottom. You want to return the volume rounded to 2 decimal places. Exmples: ```python cup_volume(1, 1, 1)==0.79 cup_volume(10, 8, 10)=...