id stringlengths 11 14 | content stringlengths 424 1.17M |
|---|---|
apps_data_4600 | Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.
```python
move_zeros([False,1,0,1,2,0,1,3,"a"]) # returns[False,1,1,2,1,3,"a",0,0]
```
def move_zeros(arr):
l = [i for i in arr if isinstance(i, bool) or i!=0]
return l+[0]*(len(arr)-len(l... |
apps_data_4601 | The Mormons are trying to find new followers and in order to do that they embark on missions.
Each time they go on a mission, every Mormons converts a fixed number of people (reach) into followers. This continues and every freshly converted Mormon as well as every original Mormon go on another mission and convert the ... |
apps_data_4602 | An **anagram** is the result of rearranging the letters of a word to produce a new word.
**Note:** anagrams are case insensitive
Complete the function to return `true` if the two arguments given are anagrams of each other; return `false` otherwise.
## Examples
* `"foefet"` is an anagram of `"toffee"`
* `"Buckethe... |
apps_data_4603 | The Ackermann function is a famous function that played a big role in computability theory as the first example of a total computable function that is not primitive recursive.
Since then the function has been a bit simplified but is still of good use. Due to its definition in terms of extremely deep recursion it can b... |
apps_data_4604 | A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are:
2332
110011
54322345
For this kata, single digit numbers will not be considered numerical palindromes.
For a given number ```num```, write a function to test if t... |
apps_data_4605 | # Task
If string has more than one neighboring dashes(e.g. --) replace they with one dash(-).
Dashes are considered neighbors even if there is some whitespace **between** them.
# Example
For `str = "we-are- - - code----warriors.-"`
The result should be `"we-are- code-warriors.-"`
# Input/Output
- `[inpu... |
apps_data_4606 | ## Task
Complete the function that receives an array of strings (`arr`) as an argument and returns all the valid Roman numerals.
Basic Roman numerals are denoted as:
```
I: 1, V: 5, X: 10, L: 50, C: 100, D: 500, M: 1000
```
For the purposes of this kata we will consider valid only the numbers in range 0 - 5000 (bot... |
apps_data_4607 | Given a certain number, how many multiples of three could you obtain with its digits?
Suposse that you have the number 362. The numbers that can be generated from it are:
```
362 ----> 3, 6, 2, 36, 63, 62, 26, 32, 23, 236, 263, 326, 362, 623, 632
```
But only:
```3, 6, 36, 63``` are multiple of three.
We need a fun... |
apps_data_4608 | I need to save some money to buy a gift. I think I can do something like that:
First week (W0) I save nothing on Sunday, 1 on Monday, 2 on Tuesday... 6 on Saturday,
second week (W1) 2 on Monday... 7 on Saturday and so on according to the table below where the days are numbered from 0 to 6.
Can you tell me how much I ... |
apps_data_4609 | Ronald's uncle left him 3 fertile chickens in his will. When life gives you chickens, you start a business selling chicken eggs which is exactly what Ronald decided to do.
A chicken lays 300 eggs in its first year. However, each chicken's egg production decreases by 20% every following year (rounded down) until when ... |
apps_data_4610 | # Task
Initially a number `1` is written on a board. It is possible to do the following operations with it:
```
multiply the number by 3;
increase the number by 5.```
Your task is to determine that using this two operations step by step, is it possible to obtain number `n`?
# Example
For `n = 1`, the result should ... |
apps_data_4611 | #Description
Everybody has probably heard of the animal heads and legs problem from the earlier years at school. It goes:
```“A farm contains chickens and cows. There are x heads and y legs. How many chickens and cows are there?” ```
Where x <= 1000 and y <=1000
#Task
Assuming there are no other types of animals, ... |
apps_data_4612 | Math hasn't always been your best subject, and these programming symbols always trip you up!
I mean, does `**` mean *"Times, Times"* or *"To the power of"*?
Luckily, you can create the function `expression_out()` to write out the expressions for you!
The operators you'll need to use are:
```python
{ '+': 'Plus ',... |
apps_data_4613 | ##Task:
You have to write a function `add` which takes two binary numbers as strings and returns their sum as a string.
##Note:
* You are `not allowed to convert binary to decimal & vice versa`.
* The sum should contain `No leading zeroes`.
##Examples:
```
add('111','10'); => '1001'
add('1101','101'); => '10010'
add(... |
apps_data_4614 | You are the judge at a competitive eating competition and you need to choose a winner!
There are three foods at the competition and each type of food is worth a different amount of points.
Points are as follows:
- Chickenwings: 5 points
- Hamburgers: 3 points
- Hotdogs: 2 points
Write a function that helps yo... |
apps_data_4615 | Our AAA company is in need of some software to help with logistics: you will be given the width and height of a map, a list of x coordinates and a list of y coordinates of the supply points, starting to count from the top left corner of the map as 0.
Your goal is to return a two dimensional array/list with every item ... |
apps_data_4616 | The goal of this Kata is to reduce the passed integer to a single digit (if not already) by converting the number to binary, taking the sum of the binary digits, and if that sum is not a single digit then repeat the process.
- n will be an integer such that 0 < n < 10^20
- If the passed integer is already a single dig... |
apps_data_4617 | Complete the function that takes a non-negative integer `n` as input, and returns a list of all the powers of 2 with the exponent ranging from 0 to `n` (inclusive).
## Examples
```python
n = 0 ==> [1] # [2^0]
n = 1 ==> [1, 2] # [2^0, 2^1]
n = 2 ==> [1, 2, 4] # [2^0, 2^1, 2^2]
```
def powers_of_two(n):... |
apps_data_4618 | You get an array of numbers, return the sum of all of the positives ones.
Example `[1,-4,7,12]` => `1 + 7 + 12 = 20`
Note: if there is nothing to sum, the sum is default to `0`.
def positive_sum(arr):
return sum(x for x in arr if x > 0)
def positive_sum(arr):
sum = 0
for e in arr:
if e > 0:
... |
apps_data_4619 | # Task
Two players - `"black"` and `"white"` are playing a game. The game consists of several rounds. If a player wins in a round, he is to move again during the next round. If a player loses a round, it's the other player who moves on the next round. Given whose turn it was on the previous round and whether he won, de... |
apps_data_4620 | Take an input string and return a string that is made up of the number of occurences of each english letter in the input followed by that letter, sorted alphabetically. The output string shouldn't contain chars missing from input (chars with 0 occurence); leave them out.
An empty string, or one with no letters, should... |
apps_data_4621 | ---
# Story
The Pied Piper has been enlisted to play his magical tune and coax all the rats out of town.
But some of the rats are deaf and are going the wrong way!
# Kata Task
How many deaf rats are there?
# Legend
* ```P``` = The Pied Piper
* ```O~``` = Rat going left
* ```~O``` = Rat going right
# Example
* ... |
apps_data_4622 | Your job is to build a function which determines whether or not there are double characters in a string (including whitespace characters). For example ```aa```, ``!!`` or ``` ```.
You want the function to return true if the string contains double characters and false if not. The test should not be case sensitive; ... |
apps_data_4623 | Make the 2D list by the sequential integers started by the ```head``` number.
See the example test cases for the expected output.
```
Note:
-10**20 < the head number <10**20
1 <= the number of rows <= 1000
0 <= the number of columms <= 1000
```
def make_2d_list(head,row,col):
return [[head + c + r*col for c ... |
apps_data_4624 | The four bases found in DNA are adenine (A), cytosine (C), guanine (G) and thymine (T).
In genetics, GC-content is the percentage of Guanine (G) and Cytosine (C) bases on a DNA molecule that are either guanine or cytosine.
Given a DNA sequence (a string) return the GC-content in percent, rounded up to 2 decimal digi... |
apps_data_4625 | In this task you have to code process planner.
You will be given initial thing, target thing and a set of processes to turn one thing into another (in the form of _[process\_name, start\_thing, end\_thing]_). You must return names of shortest sequence of processes to turn initial thing into target thing, or empty seq... |
apps_data_4626 | You're hanging out with your friends in a bar, when suddenly one of them is so drunk, that he can't speak, and when he wants to say something, he writes it down on a paper. However, none of the words he writes make sense to you. He wants to help you, so he points at a beer and writes "yvvi". You start to understand wha... |
apps_data_4627 | Simply find the closest value to zero from the list. Notice that there are negatives in the list.
List is always not empty and contains only integers. Return ```None``` if it is not possible to define only one of such values. And of course, we are expecting 0 as closest value to zero.
Examples:
```code
[2, 4, -1, -3]... |
apps_data_4628 | ## Objective
Given a number `n` we will define it's sXORe to be `0 XOR 1 XOR 2 ... XOR n` where `XOR` is the [bitwise XOR operator](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).
Write a function that takes `n` and returns it's sXORe.
## Examples
| n | sXORe n
|---------|--------
| 0 | 0
... |
apps_data_4629 | You have been speeding on a motorway and a police car had to stop you. The policeman is a funny guy that likes to play games. Before issuing penalty charge notice he gives you a choice to change your penalty.
Your penalty charge is a combination of numbers like: speed of your car, speed limit in the area, speed of th... |
apps_data_4630 | # Task
Smartphones software security has become a growing concern related to mobile telephony. It is particularly important as it relates to the security of available personal information.
For this reason, Ahmed decided to encrypt phone numbers of contacts in such a way that nobody can decrypt them. At first he tri... |
apps_data_4631 | There are two lists of different length. The first one consists of keys, the second one consists of values. Write a function ```createDict(keys, values)``` that returns a dictionary created from keys and values. If there are not enough values, the rest of keys should have a ```None``` value. If there not enough keys, j... |
apps_data_4632 | Fans of The Wire will appreciate this one.
For those that haven't seen the show, the Barksdale Organization has a simple method for encoding telephone numbers exchanged via pagers: "Jump to the other side of the 5 on the keypad, and swap 5's and 0's."
Here's a keypad for visualization.
```
┌───┬───┬───┐
│ 1 │ 2 │ 3 │... |
apps_data_4633 | You have to create a function that converts integer given as string into ASCII uppercase letters.
All ASCII characters have their numerical order in table.
For example,
```
from ASCII table, character of number 65 is "A".
```
Numbers will be next to each other, So you have to split given number to two digit long i... |
apps_data_4634 | # Task
Pac-Man got lucky today! Due to minor performance issue all his enemies have frozen. Too bad Pac-Man is not brave enough to face them right now, so he doesn't want any enemy to see him.
Given a gamefield of size `N` x `N`, Pac-Man's position(`PM`) and his enemies' positions(`enemies`), your task is to count... |
apps_data_4635 | # YOUR MISSION
An [octahedron](https://en.wikipedia.org/wiki/Octahedron) is an 8-sided polyhedron whose faces are triangles.
Create a method that outputs a 3-dimensional array of an octahedron in which the height, width, and depth are equal to the provided integer `size`, which is equal to the length from one vertex... |
apps_data_4636 | ---
# Hint
This Kata is an extension of the earlier ones in this series. Completing those first will make this task easier.
# Background
My TV remote control has arrow buttons and an `OK` button.
I can use these to move a "cursor" on a logical screen keyboard to type words...
# Keyboard
The screen "keyboard" la... |
apps_data_4637 | Mary wrote a recipe book and is about to publish it, but because of a new European law, she needs to update and include all measures in grams.
Given all the measures in tablespoon (`tbsp`) and in teaspoon (`tsp`), considering `1 tbsp = 15g` and `1 tsp = 5g`, append to the end of the measurement the biggest equivalent ... |
apps_data_4638 | ## Your story
You've always loved both Fizz Buzz katas and cuckoo clocks, and when you walked by a garage sale and saw an ornate cuckoo clock with a missing pendulum, and a "Beyond-Ultimate Raspberry Pi Starter Kit" filled with all sorts of sensors and motors and other components, it's like you were suddenly hit by a b... |
apps_data_4639 | Complete the function `power_of_two`/`powerOfTwo` (or equivalent, depending on your language) that determines if a given non-negative integer is a [power of two](https://en.wikipedia.org/wiki/Power_of_two). From the corresponding Wikipedia entry:
> *a power of two is a number of the form 2^(n) where **n** is an integ... |
apps_data_4640 | Write a function that accepts two arguments: an array/list of integers and another integer (`n`).
Determine the number of times where two integers in the array have a difference of `n`.
For example:
```
[1, 1, 5, 6, 9, 16, 27], n=4 --> 3 # (1,5), (1,5), (5,9)
[1, 1, 3, 3], n=2 --> 4 # (1,3), (1,3), ... |
apps_data_4641 | Implement the function unique_in_order which takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements.
For example:
```python
unique_in_order('AAAABBBCCDAABBB') == ['A', 'B', 'C', 'D', 'A', 'B']
unique_in_order('... |
apps_data_4642 | It's a Pokemon battle! Your task is to calculate the damage that a particular move would do using the following formula (not the actual one from the game):
Where:
* attack = your attack power
* defense = the opponent's defense
* effectiveness = the effectiveness of the attack based on the matchup (see explanation bel... |
apps_data_4643 | You should write a simple function that takes string as input and checks if it is a valid Russian postal code, returning `true` or `false`.
A valid postcode should be 6 digits with no white spaces, letters or other symbols. Empty string should also return false.
Please also keep in mind that a valid post code **cann... |
apps_data_4644 | Take a string and return a hash with all the ascii values of the characters in the string.
Returns nil if the string is empty.
The key is the character, and the value is the ascii value of the character.
Repeated characters are to be ignored and non-alphebetic characters as well.
def char_to_ascii(string):
return ... |
apps_data_4645 | > If you've finished this kata, you can try the [more difficult version](https://www.codewars.com/kata/5b256145a454c8a6990000b5).
## Taking a walk
A promenade is a way of uniquely representing a fraction by a succession of “left or right” choices.
For example, the promenade `"LRLL"` represents the fraction `4/7`.
... |
apps_data_4646 | *This is my first Kata in the Ciphers series. This series is meant to test our coding knowledge.*
## Ciphers #1 - The 01 Cipher
This cipher doesn't exist, I just created it by myself. It can't actually be used, as there isn't a way to decode it. It's a hash. Multiple sentences may also have the same result.
## How th... |
apps_data_4647 | This kata is the second part of a series: [Neighbourhood kata collection](https://www.codewars.com/collections/5b2f4db591c746349d0000ce). If this one is to easy you can try out the harder Katas.;)
___
The neighbourhood of a cell (in a matrix) are cells that are near to it. There are two popular types:
- The [Moore nei... |
apps_data_4648 | # Definition
A **number** is called **_Automorphic number_** if and only if *its square ends in the same digits as the number itself*.
___
# Task
**_Given_** a **number** *determine if it Automorphic or not* .
___
# Warm-up (Highly recommended)
# [Playing With Numbers Series](https://www.codewars.com/collections/p... |
apps_data_4649 | Your website is divided vertically in sections, and each can be of different size (height).
You need to establish the section index (starting at `0`) you are at, given the `scrollY` and `sizes` of all sections.
Sections start with `0`, so if first section is `200` high, it takes `0-199` "pixels" and second starts a... |
apps_data_4650 | Write a function that accepts a string, and returns true if it is in the form of a phone number. Assume that any integer from 0-9 in any of the spots will produce a valid phone number.
Only worry about the following format:
(123) 456-7890 (don't forget the space after the close parentheses)
Examples:
```
validPho... |
apps_data_4651 | Here your task is to Create a (nice) Christmas Tree.
You don't have to check errors or incorrect input values, every thing is ok without bad tricks, only one int parameter as input and a string to return;-)...
So what to do?First three easy examples:
````
Input: 3 and Output:
*
***
*****
###
Input 9 and Output:... |
apps_data_4652 | Given a number `n` we will define its scORe to be `0 | 1 | 2 | 3 | ... | n`, where `|` is the [bitwise OR operator](https://en.wikipedia.org/wiki/Bitwise_operation#OR).
Write a function that takes `n` and finds its scORe.
---------------------
| n | scORe n |
|---------|-------- |
| 0 | 0 |
| 1 ... |
apps_data_4653 | In this kata you will have to change every letter in a given string to the next letter in the alphabet. You will write a function `nextLetter` to do this. The function will take a single parameter `s` (string).
Examples:
```
"Hello" --> "Ifmmp"
"What is your name?" --> "Xibu jt zpvs obnf?"
"zoo" --> "app"
"zzZAaa"... |
apps_data_4654 | You have recently discovered that horses travel in a unique pattern - they're either running (at top speed) or resting (standing still).
Here's an example of how one particular horse might travel:
```
The horse Blaze can run at 14 metres/second for 60 seconds, but must then rest for 45 seconds.
After 500 seconds Bla... |
apps_data_4655 | Sort array by last character
Complete the function to sort a given array or list by last character of elements.
```if-not:haskell
Element can be an integer or a string.
```
### Example:
```
['acvd', 'bcc'] --> ['bcc', 'acvd']
```
The last characters of the strings are `d` and `c`. As `c` comes before `d`, sortin... |
apps_data_4656 | # Task
Christmas is coming. In the [previous kata](https://www.codewars.com/kata/5a405ba4e1ce0e1d7800012e), we build a custom Christmas tree with the specified characters and the specified height.
Now, we are interested in the center of the Christmas tree.
Please imagine that we build a Christmas tree with `chars =... |
apps_data_4657 | You will be given an array of positive integers. The array should be sorted by the amount of distinct perfect squares and reversed, that can be generated from each number permuting its digits.
E.g.: ```arr = [715, 112, 136, 169, 144]```
```
Number Perfect Squares w/ its Digits Amount
715 - ... |
apps_data_4658 | ### 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 product of the k maximal_** numbers.
___
### Notes
* **_Array/list_** size is *at leas... |
apps_data_4659 | # Task
An IP address contains four numbers(0-255) and separated by dots. It can be converted to a number by this way:
Given a string `s` represents a number or an IP address. Your task is to convert it to another representation(`number to IP address` or `IP address to number`).
You can assume that all inputs are va... |
apps_data_4660 | As a strict big brother, I do limit my young brother Vasya on time he spends on computer games. I define a prime-time as a time period till which Vasya have a permission to play computer games. I specify start hour and end hour as pair of integers.
I need a function which will take three numbers - a present moment (cu... |
apps_data_4661 | ###Task:
You have to write a function **pattern** which returns the following Pattern(See Examples) upto n rows, where n is parameter.
####Rules/Note:
* If the Argument is 0 or a Negative Integer then it should return "" i.e. empty string.
* The length of each line = (2n-1).
* Range of n is (-∞,100]
###Examples:
pa... |
apps_data_4662 | Consider an array that has no prime numbers, and none of its elements has any prime digit. It would start with: `[1,4,6,8,9,10,14,16,18,..]`.
`12` and `15` are not in the list because `2` and `5` are primes.
You will be given an integer `n` and your task will be return the number at that index in the array.
For exa... |
apps_data_4663 | Your task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result.
Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0).
If the input string is empty, return an empty string.
The words in the input String will onl... |
apps_data_4664 | Lucy loves to travel. Luckily she is a renowned computer scientist and gets to travel to international conferences using her department's budget.
Each year, Society for Exciting Computer Science Research (SECSR) organizes several conferences around the world. Lucy always picks one conference from that list that is hos... |
apps_data_4665 | Because my other two parts of the serie were pretty well received I decided to do another part.
Puzzle Tiles
You will get two Integer n (width) and m (height) and your task is to draw following pattern. Each line is seperated with '\n'.
Both integers are equal or greater than 1. No need to check for invalid paramet... |
apps_data_4666 | I'm new to coding and now I want to get the sum of two arrays...actually the sum of all their elements. I'll appreciate for your help.
P.S. Each array includes only integer numbers. Output is a number too.
def array_plus_array(arr1,arr2):
return sum(arr1+arr2)
def array_plus_array(arr1,arr2):
return sum(arr... |
apps_data_4667 | # Story
Well, here I am stuck in another traffic jam.
*Damn all those courteous people!*
Cars are trying to enter the main road from side-streets somewhere ahead of me and people keep letting them cut in.
Each time somebody is let in the effect ripples back down the road, so pretty soon I am not moving at all.
(S... |
apps_data_4668 | # Task
A masked number is a string that consists of digits and one asterisk (`*`) that should be replaced by exactly one digit. Given a masked number `s`, find all the possible options to replace the asterisk with a digit to produce an integer divisible by 6.
# Input/Output
`[input]` string `s`
A masked number.
`1... |
apps_data_4669 | Born a misinterpretation of [this kata](https://www.codewars.com/kata/simple-fun-number-334-two-beggars-and-gold/), your task here is pretty simple: given an array of values and an amount of beggars, you are supposed to return an array with the sum of what each beggar brings home, assuming they all take regular turns, ... |
apps_data_4670 | Note: This kata is inspired by [Convert a Number to a String!](http://www.codewars.com/kata/convert-a-number-to-a-string/). Try that one too.
## Description
We need a function that can transform a string into a number. What ways of achieving this do you know?
Note: Don't worry, all inputs will be strings, and every ... |
apps_data_4671 | In graph theory, a graph is a collection of nodes with connections between them.
Any node can be connected to any other node exactly once, and can be connected to no nodes, to some nodes, or to every other node.
Nodes cannot be connected to themselves
A path through a graph is a sequence of nodes, with every node conne... |
apps_data_4672 | In this Kata, you will create a function that converts a string with letters and numbers to the inverse of that string (with regards to Alpha and Numeric characters). So, e.g. the letter `a` will become `1` and number `1` will become `a`; `z` will become `26` and `26` will become `z`.
Example: `"a25bz"` would become `... |
apps_data_4673 | Convert a hash into an array. Nothing more, Nothing less.
```
{name: 'Jeremy', age: 24, role: 'Software Engineer'}
```
should be converted into
```
[["name", "Jeremy"], ["age", 24], ["role", "Software Engineer"]]
```
```if:python,javascript,crystal
**Note**: The output array should be sorted alphabetically.
```
Goo... |
apps_data_4674 | To participate in a prize draw each one gives his/her firstname.
Each letter of a firstname
has a value which is its rank in the English alphabet. `A` and `a` have rank `1`, `B` and `b` rank `2` and so on.
The *length* of the firstname is added to the *sum* of these ranks hence a number `som`.
An array of random ... |
apps_data_4675 | Write a function named setAlarm which receives two parameters. The first parameter, employed, is true whenever you are employed and the second parameter, vacation is true whenever you are on vacation.
The function should return true if you are employed and not on vacation (because these are the circumstances under whic... |
apps_data_4676 | Calculus class...is awesome! But you are a programmer with no time for mindless repetition. Your teacher spent a whole day covering differentiation of polynomials, and by the time the bell rang, you had already conjured up a program to automate the process.
You realize that a polynomial of degree n
anx^(n) + an-1x^(n... |
apps_data_4677 | Given is a md5 hash of a five digits long PIN. It is given as string.
Md5 is a function to hash your password:
"password123" ===> "482c811da5d5b4bc6d497ffa98491e38"
Why is this useful?
Hash functions like md5 can create a hash from string in a short time and it is impossible to find out the password, if you only got t... |
apps_data_4678 | # Task
After a long night (work, play, study) you find yourself sleeping on a bench in a park. As you wake up and try to figure out what happened you start counting trees.
You notice there are different tree sizes but there's always one size which is unbalanced. For example there are 2 size 2, 2 size 1 and 1 size 3. (... |
apps_data_4679 | You probably know the 42 number as "The answer to life, the universe and everything" according to Douglas Adams' "The Hitchhiker's Guide to the Galaxy". For Freud, the answer was quite different.
In the society he lived in, people-women in particular- had to repress their sexual needs and desires. This was simply how ... |
apps_data_4680 | # Making Change
Complete the method that will determine the minimum number of coins needed to make change for a given amount in American currency.
Coins used will be half-dollars, quarters, dimes, nickels, and pennies, worth 50¢, 25¢, 10¢, 5¢ and 1¢, respectively. They'll be represented by the symbols `H`, `Q`, `D`, ... |
apps_data_4681 | The alphabetized kata
---------------------
Re-order the characters of a string, so that they are concatenated into a new string in "case-insensitively-alphabetical-order-of-appearance" order. Whitespace and punctuation shall simply be removed!
The input is restricted to contain no numerals and only words containing ... |
apps_data_4682 | A very easy task for you!
You have to create a method, that corrects a given date string.
There was a problem in addition, so many of the date strings are broken.
Date-Format is european. That means "DD.MM.YYYY".
Some examples:
"30.02.2016" -> "01.03.2016"
"40.06.2015" -> "10.07.2015"
"11.13.2014" -> "11.01.2015"
"... |
apps_data_4683 | The aim of the kata is to try to show how difficult it can be to calculate decimals of an irrational number with a certain precision. We have chosen to get a few decimals of the number "pi" using
the following infinite series (Leibniz 1646–1716):
PI / 4 = 1 - 1/3 + 1/5 - 1/7 + ... which gives an approximation of PI /... |
apps_data_4684 | An array is said to be `hollow` if it contains `3` or more `0`s in the middle that are preceded and followed by the same number of non-zero elements. Furthermore, all the zeroes in the array must be in the middle of the array.
Write a function named `isHollow`/`is_hollow`/`IsHollow` that accepts an integer array and ... |
apps_data_4685 | A number is self-descriptive when the n'th digit describes the amount n appears in the number.
E.g. 21200:
There are two 0's in the number, so the first digit is 2.
There is one 1 in the number, so the second digit is 1.
There are two 2's in the number, so the third digit is 2.
There are no 3's in the number, so t... |
apps_data_4686 | Write a function, that doubles every second integer in a list starting from the left.
def double_every_other(l):
return [x * 2 if i % 2 else x for i, x in enumerate(l)]
double_every_other = lambda l: [e * (1 + i % 2) for i, e in enumerate(l)]
def double_every_other(lst):
return [x * (i % 2 + 1) for i, x in e... |
apps_data_4687 | The aim of the kata is to decompose `n!` (factorial n) into its prime factors.
Examples:
```
n = 12; decomp(12) -> "2^10 * 3^5 * 5^2 * 7 * 11"
since 12! is divisible by 2 ten times, by 3 five times, by 5 two times and by 7 and 11 only once.
n = 22; decomp(22) -> "2^19 * 3^9 * 5^4 * 7^3 * 11^2 * 13 * 17 * 19"
n = 25;... |
apps_data_4688 | # Write Number in Expanded Form - Part 2
This is version 2 of my ['Write Number in Exanded Form' Kata](https://www.codewars.com/kata/write-number-in-expanded-form).
You will be given a number and you will need to return it as a string in [Expanded Form](https://www.mathplacementreview.com/arithmetic/decimals.php#writ... |
apps_data_4689 | A wildlife study involving ducks is taking place in North America. Researchers are visiting some wetlands in a certain area taking a survey of what they see. The researchers will submit reports that need to be processed by your function.
## Input
The input for your function will be an array with a list of common duc... |
apps_data_4690 | `This kata is the first of the ADFGX Ciphers, the harder version can be found `here.
The ADFGX Cipher is a pretty well-known Cryptographic tool, and is essentially a modified Polybius Square.
Rather than having numbers as coordinates on the table, it has the letters:
`A, D, F, G, X`
Also, because this is the first... |
apps_data_4691 | In this Kata, you will be given a string and your task will be to return a list of ints detailing the count of uppercase letters, lowercase, numbers and special characters, as follows.
```Haskell
Solve("*'&ABCDabcde12345") = [4,5,5,3].
--the order is: uppercase letters, lowercase, numbers and special characters.
```
... |
apps_data_4692 | You're a buyer/seller and your buisness is at stake... You ___need___ to make profit... Or at least, you need to lose the least amount of money!
Knowing a list of prices for buy/sell operations, you need to pick two of them. Buy/sell market is evolving across time and the list represent this evolution. First, you nee... |
apps_data_4693 | Every Turkish citizen has an identity number whose validity can be checked by these set of rules:
- It is an 11 digit number
- First digit can't be zero
- Take the sum of 1st, 3rd, 5th, 7th and 9th digit and multiply it by 7.
Then subtract the sum of 2nd, 4th, 6th and 8th digits from this value.
Modulus 10 of the resu... |
apps_data_4694 | # Task:
Write a function that accepts an integer `n` and returns **the sum of the factorials of the first **`n`** Fibonacci numbers**
## Examples:
```python
sum_fib(2) = 2 # 0! + 1! = 2
sum_fib(3) = 3 # 0! + 1! + 1! = 3
sum_fib(4) = 5 # 0! + 1! + 1! + 2! = 5
sum_fib(10) = 295232799039604140898709551821456... |
apps_data_4695 | # Feynman's squares
Richard Phillips Feynman was a well-known American physicist and a recipient of the Nobel Prize in Physics. He worked in theoretical physics and pioneered the field of quantum computing.
Recently, an old farmer found some papers and notes that are believed to have belonged to Feynman. Among notes a... |
apps_data_4696 | # Task
John loves encryption. He can encrypt any string by the following algorithm:
```
take the first and the last letters of the word;
replace the letters between them with their number;
replace this number with the sum of it digits
until a single digit is obtained.```
Given two strings(`s1` and `s2`), re... |
apps_data_4697 | Given three arrays of integers, return the sum of elements that are common in all three arrays.
For example:
```
common([1,2,3],[5,3,2],[7,3,2]) = 5 because 2 & 3 are common in all 3 arrays
common([1,2,2,3],[5,3,2,2],[7,3,2,2]) = 7 because 2,2 & 3 are common in the 3 arrays
```
More examples in the test cases.
Go... |
apps_data_4698 | Write a function with the signature shown below:
```python
def is_int_array(arr):
return True
```
* returns `true / True` if every element in an array is an integer or a float with no decimals.
* returns `true / True` if array is empty.
* returns `false / False` for every other input.
def is_int_array(a):
... |
apps_data_4699 | Imagine two rings with numbers on them. The inner ring spins clockwise (decreasing by 1 each spin) and the outer ring spins counter clockwise (increasing by 1 each spin). We start with both rings aligned on 0 at the top, and on each move we spin each ring one increment. How many moves will it take before both rings sho... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.