id stringlengths 11 14 | content stringlengths 424 1.17M |
|---|---|
apps_data_3500 | Write function RemoveExclamationMarks which removes all exclamation marks from a given string.
def remove_exclamation_marks(s):
return s.replace('!', '')
def remove_exclamation_marks(s):
"""Removes exclamation marks from given input.
"""
return s.replace('!', '')
remove_exclamation_marks=lambda s: s.... |
apps_data_3501 | You have a grid with `$m$` rows and `$n$` columns. Return the number of unique ways that start from the top-left corner and go to the bottom-right corner. You are only allowed to move right and down.
For example, in the below grid of `$2$` rows and `$3$` columns, there are `$10$` unique paths:
```
o----o----o----o
| ... |
apps_data_3502 | Complete the solution so that it returns true if it contains any duplicate argument values. Any number of arguments may be passed into the function.
The array values passed in will only be strings or numbers. The only valid return values are `true` and `false`.
Examples:
```
solution(1, 2, 3) --> false
s... |
apps_data_3503 | The number ```89``` is the first integer with more than one digit that fulfills the property partially introduced in the title of this kata.
What's the use of saying "Eureka"? Because this sum gives the same number.
In effect: ```89 = 8^1 + 9^2```
The next number in having this property is ```135```.
See this prop... |
apps_data_3504 | Your task is to create a new implementation of `modpow` so that it computes `(x^y)%n` for large `y`. The problem with the current implementation is that the output of `Math.pow` is so large on our inputs that it won't fit in a 64-bit float.
You're also going to need to be efficient, because we'll be testing some prett... |
apps_data_3505 | In the wake of the npm's `left-pad` debacle, you decide to write a new super padding method that superceds the functionality of `left-pad`. Your version will provide the same functionality, but will additionally add right, and justified padding of string -- the `super_pad`.
Your function `super_pad` should take three ... |
apps_data_3506 | We want to know the index of the vowels in a given word, for example, there are two vowels in the word super (the second and fourth letters).
So given a string "super", we should return a list of [2, 4].
Some examples:
Mmmm => []
Super => [2,4]
Apple => [1,5]
YoMama -> [1,2,4... |
apps_data_3507 | ## Enough is enough!
Alice and Bob were on a holiday. Both of them took many pictures of the places they've been, and now they want to show Charlie their entire collection. However, Charlie doesn't like these sessions, since the motive usually repeats. He isn't fond of seeing the Eiffel tower 40 times. He tells them t... |
apps_data_3508 | ## Task
Given a positive integer `n`, calculate the following sum:
```
n + n/2 + n/4 + n/8 + ...
```
All elements of the sum are the results of integer division.
## Example
```
25 => 25 + 12 + 6 + 3 + 1 = 47
```
def halving_sum(n):
s=0
while n:
s+=n ; n>>=1
return s
def halving_sum(n): ... |
apps_data_3509 | Scientists working internationally use metric units almost exclusively. Unless that is, they wish to crash multimillion dollars worth of equipment on Mars.
Your task is to write a simple function that takes a number of meters, and outputs it using metric prefixes.
In practice, meters are only measured in "mm" (thousa... |
apps_data_3510 | Two red beads are placed between every two blue beads. There are N blue beads. After looking at the arrangement below work out the number of red beads.
@
@@
@
@@
@
@@
@
@@
@
@@
@
Implement count_red_beads(n) (in PHP count_red_beads($n); in Java, Javascript, TypeScript, C, C++ countRedBeads(n)) so that it returns the ... |
apps_data_3511 | Hector the hacker has stolen some information, but it is encrypted. In order to decrypt it, he needs to write a function that will generate a decryption key from the encryption key which he stole (it is in hexadecimal). To do this, he has to determine the two prime factors `P` and `Q` of the encyption key, and return t... |
apps_data_3512 | Just like in the ["father" kata](http://www.codewars.com/kata/find-fibonacci-last-digit/), you will have to return the last digit of the nth element in the Fibonacci sequence (starting with 1,1, to be extra clear, not with 0,1 or other numbers).
You will just get much bigger numbers, so good luck bruteforcing your way... |
apps_data_3513 | # Task
John was in math class and got bored, so he decided to fold some origami from a rectangular `a × b` sheet of paper (`a > b`). His first step is to make a square piece of paper from the initial rectangular piece of paper by folding the sheet along the bisector of the right angle and cutting off the excess part.
... |
apps_data_3514 | Create a function that will return true if all numbers in the sequence follow the same counting pattern. If the sequence of numbers does not follow the same pattern, the function should return false.
Sequences will be presented in an array of varied length. Each array will have a minimum of 3 numbers in it.
The seque... |
apps_data_3515 | # Introduction
The ragbaby cipher is a substitution cipher that encodes/decodes a text using a keyed alphabet and their position in the plaintext word they are a part of.
To encrypt the text `This is an example.` with the key `cipher`, first construct a keyed alphabet:
```
c i p h e r ... |
apps_data_3516 | Your colleagues have been good enough(?) to buy you a birthday gift. Even though it is your birthday and not theirs, they have decided to play pass the parcel with it so that everyone has an even chance of winning. There are multiple presents, and you will receive one, but not all are nice... One even explodes and cove... |
apps_data_3517 | # Let's watch a parade!
## Brief
You're going to watch a parade, but you only care about one of the groups marching. The parade passes through the street where your house is. Your house is at number `location` of the street. Write a function `parade_time` that will tell you the times when you need to appear to see all ... |
apps_data_3518 | On Unix system type files can be identified with the ls -l command which displays the type of the file in the first alphabetic letter of the file system permissions field. You can find more information about file type on Unix system on the [wikipedia page](https://en.wikipedia.org/wiki/Unix_file_types).
- '-' A regula... |
apps_data_3519 | Given two arrays of integers `m` and `n`, test if they contain *at least* one identical element. Return `true` if they do; `false` if not.
Your code must handle any value within the range of a 32-bit integer, and must be capable of handling either array being empty (which is a `false` result, as there are no duplicate... |
apps_data_3520 | The prime numbers are not regularly spaced. For example from `2` to `3` the step is `1`.
From `3` to `5` the step is `2`. From `7` to `11` it is `4`.
Between 2 and 50 we have the following pairs of 2-steps primes:
`3, 5 - 5, 7, - 11, 13, - 17, 19, - 29, 31, - 41, 43`
We will write a function `step` with parameters:
... |
apps_data_3521 | Given some points (cartesian coordinates), return true if all of them lie on a line. Treat both an empty set and a single point as a line.
```python
on_line(((1,2), (7,4), (22,9)) == True
on_line(((1,2), (-3,-14), (22,9))) == False
```
def on_line(points):
points = list(set(points))
cross_product = lambda a,... |
apps_data_3522 | # Introduction and Warm-up (Highly recommended)
# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)
___
# Task
**_Given_** an *array/list [] of integers* , **_Find_** **_The maximum difference_** *between the successive elements in its sorted form*.
___
# Note... |
apps_data_3523 | ## Description
Your job is to create a simple password validation function, as seen on many websites.
The rules for a valid password are as follows:
- There needs to be at least 1 uppercase letter.
- There needs to be at least 1 lowercase letter.
- There needs to be at least 1 number.
- The password needs to be at le... |
apps_data_3524 | Deoxyribonucleic acid, DNA is the primary information storage molecule in biological systems. It is composed of four nucleic acid bases Guanine ('G'), Cytosine ('C'), Adenine ('A'), and Thymine ('T').
Ribonucleic acid, RNA, is the primary messenger molecule in cells. RNA differs slightly from DNA its chemical structu... |
apps_data_3525 | Iahub got bored, so he invented a game to be played on paper.
He writes n integers a1, a2, ..., an. Each of those integers can be either 0 or 1. He's allowed to do exactly one move: he chooses two indices i and j (1 ≤ i ≤ j ≤ n) and flips all values ak for which their positions are in range [i, j] (that is i ≤ k ≤ j).... |
apps_data_3526 | Check your arrows
You have a quiver of arrows, but some have been damaged. The quiver contains arrows with an optional range information (different types of targets are positioned at different ranges), so each item is an arrow.
You need to verify that you have some good ones left, in order to prepare for battle:
```py... |
apps_data_3527 | This function should take two string parameters: a person's name (`name`) and a quote of theirs (`quote`), and return a string attributing the quote to the person in the following format:
```python
'[name] said: "[quote]"'
```
For example, if `name` is `'Grae'` and `'quote'` is `'Practice makes perfect'` then your fu... |
apps_data_3528 | You have to create a method "compoundArray" which should take as input two int arrays of different length and return one int array with numbers of both arrays shuffled one by one.
```Example:
Input - {1,2,3,4,5,6} and {9,8,7,6}
Output - {1,9,2,8,3,7,4,6,5,6}
```
def compound_array(a, b):
x = []
while a or b... |
apps_data_3529 | ## The Problem
James is a DJ at a local radio station. As it's getting to the top of the hour, he needs to find a song to play that will be short enough to fit in before the news block. He's got a database of songs that he'd like you to help him filter in order to do that.
## What To Do
Create `longestPossible`(`lon... |
apps_data_3530 | # Task
You are given a function that should insert an asterisk (`*`) between every pair of **even digits** in the given input, and return it as a string. If the input is a sequence, concat the elements first as a string.
## Input
The input can be an integer, a string of digits or a sequence containing integers onl... |
apps_data_3531 | A [Mersenne prime](https://en.wikipedia.org/wiki/Mersenne_prime) is a prime number that can be represented as:
Mn = 2^(n) - 1. Therefore, every Mersenne prime is one less than a power of two.
Write a function that will return whether the given integer `n` will produce a Mersenne prime or not.
The tests will check ra... |
apps_data_3532 | As a treat, I'll let you read part of the script from a classic 'I'm Alan Partridge episode:
```
Lynn: Alan, there’s that teacher chap.
Alan: Michael, if he hits me, will you hit him first?
Michael: No, he’s a customer. I cannot hit customers. I’ve been told. I’ll go and get some stock.
Alan: Yeah, chicken stock.
Phil:... |
apps_data_3533 | # Task
Write a function `deNico`/`de_nico()` that accepts two parameters:
- `key`/`$key` - string consists of unique letters and digits
- `message`/`$message` - string with encoded message
and decodes the `message` using the `key`.
First create a numeric key basing on the provided `key` by assigning each letter p... |
apps_data_3534 | Bit Vectors/Bitmaps
A bitmap is one way of efficiently representing sets of unique integers using single bits.
To see how this works, we can represent a set of unique integers between `0` and `< 20` using a vector/array of 20 bits:
```
var set = [3, 14, 2, 11, 16, 4, 6];```
```
var bitmap = [0, 0, 1, 1, 1, 0, 1, 0, 0, ... |
apps_data_3535 | Some new cashiers started to work at your restaurant.
They are good at taking orders, but they don't know how to capitalize words, or use a space bar!
All the orders they create look something like this:
`"milkshakepizzachickenfriescokeburgerpizzasandwichmilkshakepizza"`
The kitchen staff are threatening to quit,... |
apps_data_3536 | # Kata Task
You are given a list of cogs in a gear train
Each element represents the number of teeth of that cog
e.g. `[100, 50, 25]` means
* 1st cog has 100 teeth
* 2nd cog has 50 teeth
* 3rd cog has 25 teeth
If the ``nth`` cog rotates clockwise at 1 RPM what is the RPM of the cogs at each end of the gear train?... |
apps_data_3537 | In this Kata we are passing a number (n) into a function.
Your code will determine if the number passed is even (or not).
The function needs to return either a true or false.
Numbers may be positive or negative, integers or floats.
Floats are considered UNeven for this kata.
def is_even(n):
return n%2 == 0... |
apps_data_3538 | ## Story
> "You have serious coding skillz? You wannabe a [scener](https://en.wikipedia.org/wiki/Demoscene)? Complete this mission and u can get in teh crew!"
You have read a similar message on your favourite [diskmag](https://en.wikipedia.org/wiki/Disk_magazine) back in the early 90s, and got really excited. You con... |
apps_data_3539 | Implement a function that normalizes out of range sequence indexes (converts them to 'in range' indexes) by making them repeatedly 'loop' around the array. The function should then return the value at that index. Indexes that are not out of range should be handled normally and indexes to empty sequences should return u... |
apps_data_3540 | According to ISO 8601, the first calendar week (1) starts with the week containing the first thursday in january.
Every year contains of 52 (53 for leap years) calendar weeks.
**Your task is** to calculate the calendar week (1-53) from a given date.
For example, the calendar week for the date `2019-01-01` (string) sho... |
apps_data_3541 | You're given an ancient book that unfortunately has a few pages in the wrong position, fortunately your computer has a list of every page number in order from ``1`` to ``n``.
You're supplied with an array of numbers, and should return an array with each page number that is out of place. Incorrect page numbers will not... |
apps_data_3542 | This is related to my other Kata about cats and dogs.
# Kata Task
I have a cat and a dog which I got as kitten / puppy.
I forget when that was, but I do know their current ages as `catYears` and `dogYears`.
Find how long I have owned each of my pets and return as a list [`ownedCat`, `ownedDog`]
NOTES:
* Results ar... |
apps_data_3543 | Your job is to write a function which increments a string, to create a new string.
- If the string already ends with a number, the number should be incremented by 1.
- If the string does not end with a number. the number 1 should be appended to the new string.
Examples:
`foo -> foo1`
`foobar23 -> foobar24`
`foo004... |
apps_data_3544 | The Earth has been invaded by aliens. They demand our beer and threaten to destroy the Earth if we do not supply the exact number of beers demanded.
Unfortunately, the aliens only speak Morse code. Write a program to convert morse code into numbers using the following convention:
1 .----
2 ..---
3 ...--
4 ....-
5 ...... |
apps_data_3545 | For every good kata idea there seem to be quite a few bad ones!
In this kata you need to check the provided 2 dimensional array (x) for good ideas 'good' and bad ideas 'bad'. If there are one or two good ideas, return 'Publish!', if there are more than 2 return 'I smell a series!'. If there are no good ideas, as is of... |
apps_data_3546 | A lot of goods have an International Article Number (formerly known as "European Article Number") abbreviated "EAN". EAN is a 13-digits barcode consisting of 12-digits data followed by a single-digit checksum (EAN-8 is not considered in this kata).
The single-digit checksum is calculated as followed (based upon the ... |
apps_data_3547 | The town sheriff dislikes odd numbers and wants all odd numbered families out of town! In town crowds can form and individuals are often mixed with other people and families. However you can distinguish the family they belong to by the number on the shirts they wear. As the sheriff's assistant it's your job to find all... |
apps_data_3548 | # Task
Given an array of roots of a polynomial equation, you should reconstruct this equation.
___
## Output details:
* If the power equals `1`, omit it: `x = 0` instead of `x^1 = 0`
* If the power equals `0`, omit the `x`: `x - 2 = 0` instead of `x - 2x^0 = 0`
* There should be no 2 signs in a row: `x - 1 = 0` ins... |
apps_data_3549 | Write a function that takes a list of at least four elements as an argument and returns a list of the middle two or three elements in reverse order.
def reverse_middle(lst):
l = len(lst)//2 - 1
return lst[l:-l][::-1]
def reverse_middle(a):
l=len(a)//2
return a[-l:l-2:-1]
def reverse_middle(lst):
... |
apps_data_3550 | In this Kata, you're to complete the function `sum_square_even_root_odd`.
You will be given a list of numbers, `nums`, as the only argument to the function. Take each number in the list and *square* it if it is even, or *square root* the number if it is odd. Take this new list and find the *sum*, rounding to two decim... |
apps_data_3551 | # Task
Given array of integers, for each position i, search among the previous positions for the last (from the left) position that contains a smaller value. Store this value at position i in the answer. If no such value can be found, store `-1` instead.
# Example
For `items = [3, 5, 2, 4, 5]`, the output should be... |
apps_data_3552 | You are playing euchre and you want to know the new score after finishing a hand. There are two teams and each hand consists of 5 tricks. The team who wins the majority of the tricks will win points but the number of points varies. To determine the number of points, you must know which team called trump, how many trick... |
apps_data_3553 | There's a new security company in Paris, and they decided to give their employees an algorithm to make first name recognition faster. In the blink of an eye, they can now detect if a string is a first name, no matter if it is a one-word name or an hyphenated name. They're given this documentation with the algorithm:
... |
apps_data_3554 | Zonk is addictive dice game. In each round player rolls 6 dice. Then (s)he composes combinations from them. Each combination gives certain points.
Then player can take one or more dice combinations to his hand and re-roll remaining dice or save his score. Dice in player's hand won't be taken into account in subsequen... |
apps_data_3555 | Given the number n, return a string which shows the minimum number of moves to complete the tower of Hanoi consisting of n layers.
Tower of Hanoi : https://en.wikipedia.org/wiki/Tower_of_Hanoi
Example - 2 layered Tower of Hanoi
Input: n=2
Start
[[2, 1], [], []]
Goal
[[], [], [2, 1]]
Expected Output : '[[2, 1], []... |
apps_data_3556 | Base on the fairy tale [Diamonds and Toads](https://en.wikipedia.org/wiki/Diamonds_and_Toads) from Charles Perrault. In this kata you will have to complete a function that take 2 arguments:
- A string, that correspond to what the daugther says.
- A string, that tell you wich fairy the girl have met, this one can be `... |
apps_data_3557 | Given a number **n**, return the number of positive odd numbers below **n**, EASY!
Expect large Inputs!
def odd_count(n):
return len(range(1, n, 2))
def odd_count(n):
if n < 1:
return 0
return int(n / 2)
def odd_count(n):
#Return number of positive odd numbers below N
#Find number... |
apps_data_3558 | Your coworker was supposed to write a simple helper function to capitalize a string (that contains a single word) before they went on vacation.
Unfortunately, they have now left and the code they gave you doesn't work. Fix the helper function they wrote so that it works as intended (i.e. make the first character in th... |
apps_data_3559 | The male gametes or sperm cells in humans and other mammals are heterogametic and contain one of two types of sex chromosomes. They are either X or Y. The female gametes or eggs however, contain only the X sex chromosome and are homogametic.
The sperm cell determines the sex of an individual in this case. If a sperm c... |
apps_data_3560 | You are a skier (marked below by the `X`). You have made it to the Olympics! Well done.
```
\_\_\_X\_
\*\*\*\*\*\
\*\*\*\*\*\*\
\*\*\*\*\*\*\*\
\*\*\*\*\*\*\*\*\
\*\*\*\*\*\*\*\*\*\\.\_\_\_\_/
```
Your job in this kata is to calculate the maximum speed you will achieve during your downhill run. The speed is dictated ... |
apps_data_3561 | Another Fibonacci... yes but with other kinds of result.
The function is named `aroundFib` or `around_fib`, depending of the language.
Its parameter is `n` (positive integer).
First you have to calculate `f` the value of `fibonacci(n)` with `fibonacci(0) --> 0` and
`fibonacci(1) --> 1` (see: )
- 1) Find the count of ... |
apps_data_3562 | In computer science and discrete mathematics, an [inversion](https://en.wikipedia.org/wiki/Inversion_%28discrete_mathematics%29) is a pair of places in a sequence where the elements in these places are out of their natural order. So, if we use ascending order for a group of numbers, then an inversion is when larger num... |
apps_data_3563 | Final kata of the series (highly recommended to compute [layers](https://www.codewars.com/kata/progressive-spiral-number-position/) and [branch](https://www.codewars.com/kata/progressive-spiral-number-branch/) first to get a good idea), this is a blatant ripoff of [the one offered on AoC](http://adventofcode.com/2017/d... |
apps_data_3564 | write me a function `stringy` that takes a `size` and returns a `string` of alternating `'1s'` and `'0s'`.
the string should start with a `1`.
a string with `size` 6 should return :`'101010'`.
with `size` 4 should return : `'1010'`.
with `size` 12 should return : `'101010101010'`.
The size will always be positive ... |
apps_data_3565 | In this Kata, you will be given a lower case string and your task will be to remove `k` characters from that string using the following rule:
```Python
- first remove all letter 'a', followed by letter 'b', then 'c', etc...
- remove the leftmost character first.
```
```Python
For example:
solve('abracadabra', 1) = 'b... |
apps_data_3566 | Given two integer arrays where the second array is a shuffled duplicate of the first array with one element missing, find the missing element.
Please note, there may be duplicates in the arrays, so checking if a numerical value exists in one and not the other is not a valid solution.
```
find_missing([1, 2, 2, 3], [1... |
apps_data_3567 | You have to write a function that describe Leo:
```python
def leo(oscar):
pass
```
if oscar was (integer) 88, you have to return "Leo finally won the oscar! Leo is happy".
if oscar was 86, you have to return "Not even for Wolf of wallstreet?!"
if it was not 88 or 86 (and below 88) you should return "When will you gi... |
apps_data_3568 | Your car is old, it breaks easily. The shock absorbers are gone and you think it can handle about 15 more bumps before it dies totally.
Unfortunately for you, your drive is very bumpy! Given a string showing either flat road ("\_") or bumps ("n"), work out if you make it home safely. 15 bumps or under, return "Woohoo!... |
apps_data_3569 | In Russia regular bus tickets usually consist of 6 digits. The ticket is called lucky when the sum of the first three digits equals to the sum of the last three digits. Write a function to find out whether the ticket is lucky or not. Return true if so, otherwise return false. Consider that input is always a string. Wat... |
apps_data_3570 | In this Kata, we will calculate the **minumum positive number that is not a possible sum** from a list of positive integers.
```
solve([1,2,8,7]) = 4 => we can get 1, 2, 3 (from 1+2), but we cannot get 4. 4 is the minimum number not possible from the list.
solve([4,1,2,3,12]) = 11. We can get 1, 2, 3, 4, 4+1=5, 4+2=... |
apps_data_3571 | You're laying out a rad pixel art mural to paint on your living room wall in homage to [Paul Robertson](http://68.media.tumblr.com/0f55f7f3789a354cfcda7c2a64f501d1/tumblr_o7eq3biK9s1qhccbco1_500.png), your favorite pixel artist.
You want your work to be perfect down to the millimeter. You haven't decided on the dimens... |
apps_data_3572 | ### Task
King Arthur and his knights are having a New Years party. Last year Lancelot was jealous of Arthur, because Arthur had a date and Lancelot did not, and they started a duel.
To prevent this from happening again, Arthur wants to make sure that there are at least as many women as men at this year's party. He g... |
apps_data_3573 | You are given three piles of casino chips: white, green and black chips:
* the first pile contains only white chips
* the second pile contains only green chips
* the third pile contains only black chips
Each day you take exactly two chips of different colors and head to the casino. You can choose any color, but you a... |
apps_data_3574 | The dragon's curve is a self-similar fractal which can be obtained by a recursive method.
Starting with the string `D0 = 'Fa'`, at each step simultaneously perform the following operations:
```
replace 'a' with: 'aRbFR'
replace 'b' with: 'LFaLb'
```
For example (spaces added for more visibility) :
```
1st iterati... |
apps_data_3575 | # Task
For the given set `S` its powerset is the set of all possible subsets of `S`.
Given an array of integers nums, your task is to return the powerset of its elements.
Implement an algorithm that does it in a depth-first search fashion. That is, for every integer in the set, we can either choose to take or not tak... |
apps_data_3576 | Complete the function that takes one argument, a list of words, and returns the length of the longest word in the list.
For example:
```python
['simple', 'is', 'better', 'than', 'complex'] ==> 7
```
Do not modify the input list.
def longest(words):
return max(map(len, words))
def longest(words):
return ma... |
apps_data_3577 | Fibonacci numbers are generated by setting F0 = 0, F1 = 1, and then using the formula:
# Fn = Fn-1 + Fn-2
Your task is to efficiently calculate the **n**th element in the Fibonacci sequence and then count the occurrence of each digit in the number. Return a list of integer pairs sorted in **descending** order.
10 ≤ ... |
apps_data_3578 | Your classmates asked you to copy some paperwork for them. You know that there are 'n' classmates and the paperwork has 'm' pages.
Your task is to calculate how many blank pages do you need.
### Example:
```python
paperwork(5, 5) == 25
```
**Note:** if `n < 0` or `m < 0` return `0`!
Waiting for translations and Fee... |
apps_data_3579 | You may be familiar with the concept of combinations: for example, if you take 5 cards from a 52 cards deck as you would playing poker, you can have a certain number (2,598,960, would you say?) of different combinations.
In mathematics the number of *k* combinations you can have taking from a set of *n* elements is ca... |
apps_data_3580 | Imagine that you have an array of 3 integers each representing a different person. Each number can be 0, 1, or 2 which represents the number of hands that person holds up.
Now imagine there is a sequence which follows these rules:
* None of the people have their arms raised at first
* Firstly, a person raises 1 hand; ... |
apps_data_3581 | Thanks to the effects of El Nino this year my holiday snorkelling trip was akin to being in a washing machine... Not fun at all.
Given a string made up of '~' and '\_' representing waves and calm respectively, your job is to check whether a person would become seasick.
Remember, only the process of change from wave t... |
apps_data_3582 | Implement `String#digit?` (in Java `StringUtils.isDigit(String)`), which should return `true` if given object is a digit (0-9), `false` otherwise.
def is_digit(n):
return n.isdigit() and len(n)==1
import re
def is_digit(n):
return bool(re.match("\d\Z", n))
import re
def is_digit(n):
return bool(re.fullm... |
apps_data_3583 | Given an array of ones and zeroes, convert the equivalent binary value to an integer.
Eg: `[0, 0, 0, 1]` is treated as `0001` which is the binary representation of `1`.
Examples:
```
Testing: [0, 0, 0, 1] ==> 1
Testing: [0, 0, 1, 0] ==> 2
Testing: [0, 1, 0, 1] ==> 5
Testing: [1, 0, 0, 1] ==> 9
Testing: [0, 0, 1, 0] =... |
apps_data_3584 | You have to write two methods to *encrypt* and *decrypt* strings.
Both methods have two parameters:
```
1. The string to encrypt/decrypt
2. The Qwerty-Encryption-Key (000-999)
```
The rules are very easy:
```
The crypting-regions are these 3 lines from your keyboard:
1. "qwertyuiop"
2. "asdfghjkl"
3. "zxcvbnm,."
If ... |
apps_data_3585 | You will receive an uncertain amount of integers in a certain order ```k1, k2, ..., kn```.
You form a new number of n digits in the following way:
you take one of the possible digits of the first given number, ```k1```, then the same with the given number ```k2```, repeating the same process up to ```kn``` and you con... |
apps_data_3586 | HTML Element Generator
In this kata, you will be creating a python function that will take arguments and turn them into an HTML element.
An HTML tag has three parts:
The opening tag, which consists of a tag name and potentially attributes, all in between angle brackets.
The element content, which is the data that is s... |
apps_data_3587 | # Task
John has an important number, and he doesn't want others to see it.
He decided to encrypt the number, using the following steps:
```
His number is always a non strict increasing sequence
ie. "123"
He converted each digit into English words.
ie. "123"--> "ONETWOTHREE"
And then, rearrange the letters randomly.... |
apps_data_3588 | In this Kata you are expected to find the coefficients of quadratic equation of the given two roots (`x1` and `x2`).
Equation will be the form of ```ax^2 + bx + c = 0```
Return type is a Vector (tuple in Rust, Array in Ruby) containing coefficients of the equations in the order `(a, b, c)`.
Since there are infinitel... |
apps_data_3589 | Make a function that receives a value, ```val``` and outputs the smallest higher number than the given value, and this number belong to a set of positive integers that have the following properties:
- their digits occur only once
- they are odd
- they are multiple of three
```python
next_numb(12) == 15
next_numb(1... |
apps_data_3590 | Given two arrays of strings, return the number of times each string of the second array appears in the first array.
#### Example
```python
array1 = ['abc', 'abc', 'xyz', 'cde', 'uvw']
array2 = ['abc', 'cde', 'uap']
```
How many times do the elements in `array2` appear in `array1`?
* `'abc'` appears twice in the fi... |
apps_data_3591 | In the morning all the doors in the school are closed. The school is quite big: there are **N** doors. Then pupils start coming. It might be hard to believe, but all of them want to study! Also, there are exactly **N** children studying in this school, and they come one by one.
When these strange children pass by some... |
apps_data_3592 | Given an `x` and `y` find the smallest and greatest numbers **above** and **below** a given `n` that are divisible by both `x` and `y`.
### Examples
```python
greatest(2, 3, 20) => 18 # 18 is the greatest number under 20 that is divisible by both 2 and 3
smallest(2, 3, 20) => 24 # 24 is the smallest number above 2... |
apps_data_3593 | Given a string and an array of integers representing indices, capitalize all letters at the given indices.
For example:
* `capitalize("abcdef",[1,2,5]) = "aBCdeF"`
* `capitalize("abcdef",[1,2,5,100]) = "aBCdeF"`. There is no index 100.
The input will be a lowercase string with no spaces and an array of digits.
Goo... |
apps_data_3594 | **An [isogram](https://en.wikipedia.org/wiki/Isogram)** (also known as a "nonpattern word") is a logological term for a word or phrase without a repeating letter. It is also used by some to mean a word or phrase in which each letter appears the same number of times, not necessarily just once.
You task is to write a me... |
apps_data_3595 | Your task is to Combine two Strings. But consider the rule...
By the way you don't have to check errors or incorrect input values, everything is ok without bad tricks, only two input strings and as result one output string;-)...
And here's the rule:
Input Strings `a` and `b`: For every character in string `a` swap ... |
apps_data_3596 | # Task
Determine the client's membership level based on the invested `amount` of money and the given thresholds for membership levels.
There are four membership levels (from highest to lowest): `Platinum, Gold, Silver, Bronze`
The minimum investment is the threshold limit for `Bronze` membership. If the given amount... |
apps_data_3597 | Create a method `sayHello`/`say_hello`/`SayHello` that takes as input a name, city, and state to welcome a person. Note that `name` will be an array consisting of one or more values that should be joined together with one space between each, and the length of the `name` array in test cases will vary.
Example:
```pyth... |
apps_data_3598 | Finding your seat on a plane is never fun, particularly for a long haul flight... You arrive, realise again just how little leg room you get, and sort of climb into the seat covered in a pile of your own stuff.
To help confuse matters (although they claim in an effort to do the opposite) many airlines omit the letters... |
apps_data_3599 | We define the function `f1(n,k)`, as the least multiple of `n` that has all its digits less than `k`.
We define the function `f2(n,k)`, as the least multiple of `n` that has all the digits that are less than `k`.
Each digit may occur more than once in both values of `f1(n,k)` and `f2(n,k)`.
The possible values for ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.