formatted_conversations stringlengths 1.13k 138k |
|---|
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.What adds up
===========
Given three arrays of integers your task is to create an algorithm that finds the numbers in the first two arrays whose sum is equal to any number in... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this Kata, you will check if it is possible to convert a string to a palindrome by changing one character.
For instance:
```Haskell
solve ("abbx") = True, because we can ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Your job at E-Corp is both boring and difficult. It isn't made any easier by the fact that everyone constantly wants to have a meeting with you, and that the meeting rooms are... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Kevin is noticing his space run out! Write a function that removes the spaces from the values and returns an array showing the space decreasing.
For example, running this func... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Will you make it?
You were camping with your friends far away from home, but when it's time to go back, you realize that your fuel is running out and the nearest pump is ```5... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Step through my `green glass door`.
You can take the `moon`, but not the `sun`.
You can take your `slippers`, but not your `sandals`.
You can go through `yelling`, but not ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Consider the following series:
`1, 2, 4, 8, 16, 22, 26, 38, 62, 74, 102, 104, 108, 116, 122`
It is generated as follows:
* For single digit integers, add the number to itse... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You will be given a string (x) featuring a cat 'C', a dog 'D' and a mouse 'm'. The rest of the string will be made up of '.'.
You need to find out if the cat can catch the m... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You're playing a game with a friend involving a bag of marbles. In the bag are ten marbles:
* 1 smooth red marble
* 4 bumpy red marbles
* 2 bumpy yellow marbles
* 1 smooth ye... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Passer ratings are the generally accepted standard for evaluating NFL quarterbacks.
I knew a rating of 100 is pretty good, but never knew what makes up the rating.
So out of c... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You will be given a vector of strings. You must sort it alphabetically (case-sensitive, and based on the ASCII values of the chars) and then return the first value.
The retur... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Help a fruit packer sort out the bad apples.
There are 7 varieties of apples, all packaged as pairs and stacked in a fruit box. Some of the apples are spoiled. The fruit pac... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In a far away country called AlgoLandia, there are `N` islands numbered `1` to `N`. Each island is denoted by `k[i]`. King Algolas, king of AlgoLandia, built `N - 1` bridges i... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Imagine if there were no order of operations. Instead, you would do the problem from left to right. For example, the equation `$a +b *c /d$` would become `$(((a+b)*c)//d)$` (... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Two tortoises named ***A*** and ***B*** must run a race. ***A*** starts with an average speed of ```720 feet per hour```.
Young ***B*** knows she runs faster than ***A***, and... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You drop a ball from a given height. After each bounce, the ball returns to some fixed proportion of its previous height. If the ball bounces to height 1 or less, we consider ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a set of elements (integers or string characters) that may occur more than once, we need to know the amount of subsets that none of their values have repetitions.
Let's ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.It's tricky keeping track of who is owed what when spending money in a group. Write a function to balance the books.
* The function should take one parameter: an object/dict ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Third day at your new cryptoanalyst job and you come across your toughest assignment yet. Your job is to implement a simple keyword cipher. A keyword cipher is a type of monoa... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create a function that takes a string as a parameter and does the following, in this order:
1. replaces every letter with the letter following it in the alphabet (see note be... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Complete the method so that it formats the words into a single comma separated value. The last word should be separated by the word 'and' instead of a comma. The method takes ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
let F(N) be the sum square of digits of N. So:
`F(1) = 1, F(3) = 9, F(123) = 14`
Choose a number A, the sequence {A0, A1, ...} is defined as followed:
```
A0 ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You get a new job working for Eggman Movers. Your first task is to write a method that will allow the admin staff to enter a person’s name and return what that person's role ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Remove the parentheses
=
In this kata you are given a string for example:
```python
"example(unwanted thing)example"
```
Your task is to remove everything inside the parenth... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this Kata, you will be given a string that has lowercase letters and numbers. Your task is to compare the number groupings and return the largest number. Numbers will not h... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.#Bubbleing around
Since everybody hates chaos and loves sorted lists we should implement some more sorting algorithms. Your task is to implement a Bubble sort (for some help ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Paul is an excellent coder and sits high on the CW leaderboard. He solves kata like a banshee but would also like to lead a normal life, with other activities. But he just can... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Yesterday you found some shoes in your room. Each shoe is described by two values:
```
type indicates if it's a left or a right shoe;
size is the size of the shoe.
```... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
The string is called `prime` if it cannot be constructed by concatenating some (more than one) equal strings together.
For example, "abac" is prime, but "xyxy" is no... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create a function that transforms any positive number to a string representing the number in words. The function should work for all numbers between 0 and 999999.
### Exampl... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Your Story
"A *piano* in the home meant something." - *Fried Green Tomatoes at the Whistle Stop Cafe*
You've just realized a childhood dream by getting a beautiful and bea... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# A History Lesson
Tetris is a puzzle video game originally designed and programmed by Soviet Russian software engineer Alexey Pajitnov. The first playable version was comple... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
You are given two strings s and t of the same length, consisting of uppercase English letters. Your task is to find the minimum number of "replacement operations" need... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Complete the square sum function so that it squares each number passed into it and then sums the results together.
For example, for `[1, 2, 2]` it should return `9` because `... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Given a `sequence` of integers, check whether it is possible to obtain a strictly increasing sequence by erasing no more than one element from it.
# Example
For `se... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Task
Write a function that accepts two arguments and generates a sequence containing the integers from the first argument to the second inclusive.
## Input
Pair of inte... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Story&Task
There are three parties in parliament. The "Conservative Party", the "Reformist Party", and a group of independants.
You are a member of the “Conservative Part... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a code that receives an array of numbers or strings, goes one by one through it while taking one value out, leaving one value in, taking, leaving, and back again to the ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a function `take_umbrella()` that takes two arguments: a string representing the current weather and a float representing the chance of rain today.
Your function should... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a program that, given a word, computes the scrabble score for that word.
## Letter Values
You'll need these:
```
Letter Value
A, E, I, O, U,... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You have n dices each one having s sides numbered from 1 to s.
How many outcomes add up to a specified number k?
For example if we roll four normal six-sided dices we
have fo... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# One is the loneliest number
## Task
The range of vision of a digit is its own value. `1` can see one digit to the left and one digit to the right,` 2` can see two digits, ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.There are just some things you can't do on television. In this case, you've just come back from having a "delicious" Barth burger and you're set to give an interview. The Bart... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Introduction
You are the developer working on a website which features a large counter on its homepage, proudly displaying the number of happy customers who have downloaded... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.**Step 1:** Create a function called `encode()` to replace all the lowercase vowels in a given string with numbers according to the following pattern:
```
a -> 1
e -> 2
i -> 3... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given an array of integers, return the smallest common factors of all integers in the array.
When i say **Smallest Common Factor** i mean the smallest number above 1 that can... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Timed Reading is an educational tool used in many schools to improve and advance reading skills. A young elementary student has just finished his very first timed read... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.This kata is all about adding numbers.
You will create a function named add. This function will return the sum of all the arguments. Sounds easy, doesn't it??
Well here's th... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In the following 6 digit number:
```
283910
```
`91` is the greatest sequence of 2 consecutive digits.
In the following 10 digit number:
```
1234567890
```
`67890` is the ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The task is very simple.
You must to return pyramids. Given a number ```n``` you print a pyramid with ```n``` floors
For example , given a ```n=4``` you must to print this ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Complete the function/method so that it returns the url with anything after the anchor (`#`) removed.
## Examples
```python
# returns 'www.codewars.com'
remove_url_anchor('... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are given a string of numbers between 0-9. Find the average of these numbers and return it as a floored whole number (ie: no decimal places) written out as a string. Eg:
... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.As a part of this Kata, you need to create a function that when provided with a triplet, returns the index of the numerical element that lies between the other two elements.
... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given an integer, if the length of it's digits is a perfect square, return a square block of sqroot(length) * sqroot(length). If not, simply return "Not a perfect square!".
E... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Given string `s`, which contains only letters from `a to z` in lowercase.
A set of alphabet is given by `abcdefghijklmnopqrstuvwxyz`.
2 sets of alphabets mean 2 o... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The new "Avengers" movie has just been released! There are a lot of people at the cinema box office standing in a huge line. Each of them has a single `100`, `50` or `25` doll... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.###Instructions
Write a function that takes a negative or positive integer, which represents the number of minutes before (-) or after (+) Sunday midnight, and returns the cu... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Task
You will receive a string consisting of lowercase letters, uppercase letters and digits as input. Your task is to return this string as blocks separated by dashes (`"... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a string of words (x), you need to return an array of the words, sorted alphabetically by the final character in each.
If two words have the same last letter, they retu... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## The story you are about to hear is true
Our cat, Balor, sadly died of cancer in 2015.
While he was alive, the three neighborhood cats Lou, Mustache Cat, and Raoul all reco... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create a function that takes a list of one or more non-negative integers, and arranges them such that they form the largest possible number.
Examples:
`largestArrangement([4... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are given an array that of arbitrary depth that needs to be nearly flattened into a 2 dimensional array. The given array's depth is also non-uniform, so some parts may be ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Find the sum of the odd numbers within an array, after cubing the initial integers. The function should return `undefined`/`None`/`nil`/`NULL` if any of the values aren't numb... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Scenario
With **_Cereal crops_** like wheat or rice, before we can eat the grain kernel, we need to remove that inedible hull, or *to separate the wheat from the chaff*.
_... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The "Russian Peasant Method" is an old algorithm used by Russian peasants (and before them ancient Egyptians) to perform multiplication. Consider that X and Y are two numbers... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a string and an array of index numbers, return the characters of the string rearranged to be in the order specified by the accompanying array.
Ex:
scramble('abcd', [0,... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Program a function `sumAverage(arr)` where `arr` is an array containing arrays full of numbers, for example:
```python
sum_average([[1, 2, 2, 1], [2, 2, 2, 1]])
```
First, d... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create a function that interprets code in the esoteric language **Poohbear**
## The Language
Poohbear is a stack-based language largely inspired by Brainfuck. It has a maxim... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The Tower of Hanoi problem involves 3 towers. A number of rings decreasing in size are placed on one tower. All rings must then be moved to another tower, but at no point ca... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Check if it is a vowel(a, e, i, o, u,) on the ```n``` position in a string (the first argument). Don't forget about uppercase.
A few cases:
```
{
checkVowel('cat', 1) -> ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.We are given a sequence of coplanar points and see all the possible triangles that may be generated which all combinations of three points.
We have the following list of poin... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given: an array containing hashes of names
Return: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an am... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In this Kata, you will be given an array and your task will be to determine if an array is in ascending or descending order and if it is rotated or not.
Consider the array `... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
You are given a positive integer `n`. We intend to make some ascending sequences according to the following rules:
1. Make a sequence of length 1: [ n ]
2. Or, ins... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a method that will search an array of strings for all strings that contain another string, ignoring capitalization. Then return an array of the found strings.
The meth... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a sorted array of numbers, return the summary of its ranges.
## Examples
```python
summary_ranges([1, 2, 3, 4]) == ["1->4"]
summary_ranges([1, 1, 1, 1, 1]) == ["1"]
sum... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.KISS stands for Keep It Simple Stupid.
It is a design principle for keeping things simple rather than complex.
You are the boss of Joe.
Joe is submitting words to you to pub... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Oh no! You have stumbled upon a mysterious signal consisting of beeps of various lengths, and it is of utmost importance that you find out the secret message hidden in the be... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Return a new array consisting of elements which are multiple of their own index in input array (length > 1).
Some cases:
```
[22, -6, 32, 82, 9, 25] => [-6, 32, 25]
[68, ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The number `1035` is the smallest integer that exhibits a non frequent property: one its multiples, `3105 = 1035 * 3`, has its same digits but in different order, in other wor... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Your users passwords were all stole in the Yahoo! hack, and it turns out they have been lax in creating secure passwords. Create a function that checks their new password (pa... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Welcome to my (amazing) kata!
You are given a gigantic number to decode. Each number is a code that alternates in a pattern between encoded text and a smaller, encoded nu... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.```if-not:ruby
Create a function, that accepts an arbitrary number of arrays and returns a single array generated by alternately appending elements from the passed in argument... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.How many licks does it take to get to the tootsie roll center of a tootsie pop?
A group of engineering students from Purdue University reported that its licking machine, mode... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Find the length between 2 co-ordinates. The co-ordinates are made of integers between -20 and 20 and will be given in the form of a 2D array:
(0,0) and (5,-7) would be [ [ 0... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are working at a lower league football stadium and you've been tasked with automating the scoreboard.
The referee will shout out the score, you have already set up the vo... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In mathematics, a [Diophantine equation](https://en.wikipedia.org/wiki/Diophantine_equation) is a polynomial equation, usually with two or more unknowns, such that only the in... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.We are interested in collecting the triples of positive integers ```(a, b, c)``` that fulfill the following equation:
```python
a² + b² = c³
```
The first triple with the lowe... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Cascading Style Sheets (CSS) is a style sheet language used for describing the look and formatting of a document written in a markup language. A style sheet consists of a list... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The number `198` has the property that `198 = 11 + 99 + 88, i.e., if each of its digits is concatenated twice and then summed, the result will be the original number`. It turn... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.DNA sequencing data can be stored in many different formats. In this Kata, we will be looking at SAM formatting. It is a plain text file where every line (excluding the first ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Consider a sequence generation that follows the following steps. We will store removed values in variable `res`. Assume `n = 25`:
```Haskell
-> [1,2,3,4,5,6,7,8,9,10,11,12,13,... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Consider the following ciphering algorithm:
```
For each character replace it with its code.
Concatenate all of the obtained numbers.
```
Given a ciphered string, retu... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.One suggestion to build a satisfactory password is to start with a memorable phrase or sentence and make a password by extracting the first letter of each word.
Even better ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Hofstadter sequences are a family of related integer sequences, among which the first ones were described by an American professor Douglas Hofstadter in his book Gödel, Escher... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.It's 3AM and you get the dreaded call from a customer: the program your company sold them is hanging. You eventually trace the problem down to a call to a function named `myst... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Mr. Scrooge has a sum of money 'P' that he wants to invest. Before he does, he wants to know how many years 'Y' this sum 'P' has to be kept in the bank in order for it to amou... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You probably know the "like" system from Facebook and other pages. People can "like" blog posts, pictures or other items. We want to create the text that should be displayed n... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Your task is to convert a given number into a string with commas added for easier readability. The number should be rounded to 3 decimal places and the commas should be added... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Consider the following expansion:
```Haskell
solve("3(ab)") = "ababab" -- "ab" repeats 3 times
solve("2(a3(b))" = "abbbabbb" -- "a3(b)" == "abbb" repeats twice.
```
Given a s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.