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.The code provided is supposed replace all the dots `.` in the specified String `str` with dashes `-`
But it's not working properly.
# Task
Fix the bug so we can all go home... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You need count how many valleys you will pass.
Start is always from zero level.
Every time you go down below 0 level counts as an entry of a valley, and as you go up to 0 le... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Apparently "Put A Pillow On Your Fridge Day is celebrated on the 29th of May each year, in Europe and the U.S. The day is all about prosperity, good fortune, and having bit of... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.*This is the advanced version of the
[Minimum and Maximum Product of k Elements](https://www.codewars.com/kata/minimum-and-maximum-product-of-k-elements/) kata.*
---
Given ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Given a sequence of items and a specific item in that sequence, return the item immediately following the item specified. If the item occurs more than once in a sequence, retu... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Assume `"#"` is like a backspace in string. This means that string `"a#bc#d"` actually is `"bd"`
Your task is to process a string with `"#"` symbols.
## Examples
```
"abc#... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Decompose a number `num` into an array (tuple in Haskell, array of arrays `long[][]` in C# or Java) of the form `[[k1,k2,k3...], r]`, `([k1,k2,k3...], r)` in Haskell, `[[k1,k... |
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 (`str`) containing a base-10 integer between `0` and `10000`, convert the integer to its binary representation. At that point, obtain a count of the maximum amo... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.### Task
You've just moved into a perfectly straight street with exactly ```n``` identical houses on either side of the road. Naturally, you would like to find out the house n... |
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 are a builder and you are assigned a job of building a wall with a specific size (God knows why...).
Create a function called `build_a_wall` (or `buildAWall`... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
You're given a two-dimensional array of integers `matrix`. Your task is to determine the smallest non-negative integer that is not present in this array.
# Input/Outp... |
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 two positive integer lists with a random number of elements (1 <= n <= 100). Create a [GCD](https://en.wikipedia.org/wiki/Greatest_common_divisor) matrix and cal... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Take debugging to a whole new level:
Given a string, remove every *single* bug.
This means you must remove all instances of the word 'bug' from within a given string, *unles... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Some children are playing rope skipping game. Children skip the rope at roughly the same speed: `once per second`. If the child fails during the jump, he needs to tidy ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
Two arrays are called similar if one can be obtained from another by swapping at most one pair of elements.
Given two arrays, check whether they are similar.
# Exampl... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Sam is an avid collector of numbers. Every time he finds a new number he throws it on the top of his number-pile. Help Sam organise his collection so he can take it to the Int... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.There is no single treatment that works for every phobia, but some people cure it by being gradually exposed to the phobic situation or object. In this kata we will try curing... |
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 numbers, return the additive inverse of each. Each positive becomes negatives, and the negatives become positives.
~~~if-not:racket
```
invert([1,2,3,4,5]) == ... |
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 three non negative integers `a`, `b` and `n`, and making an infinite sequence just like fibonacci sequence, use the following rules:
- step 1: use `ab`... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# 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"...
The screen "keybo... |
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 are to implement a function that parses a string which is composed from tokens of the form 'n1-n2,n3,n4-n5:n6' where 'nX' is a positive integer. Each token re... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Situation
You have been hired by a company making electric garage doors. Accidents with the present product line have resulted in numerous damaged cars, broken limbs and sev... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Complete the solution. It should try to retrieve the value of the array at the index provided. If the index is out of the array's max bounds then it should return the default ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create an OR function, without use of the 'or' keyword, that takes an list of boolean values and runs OR against all of them.
Assume there will be between 1 and 6 variables, ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The Spelling Bee bees are back...
# How many bees are in the beehive?
* bees can be facing UP, DOWN, LEFT, RIGHT, and now also _diagonally_ up/down/left/right
* bees can sha... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Regular Tic-Tac-Toe is boring.
That's why in this Kata you will be playing Tic-Tac-Toe in **3D** using a 4 x 4 x 4 matrix!
# Kata Task
Play the game. Work out who wins.
... |
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 two sorted arrays that contain only integers. Your task is to find a way to merge them into a single one, sorted in **ascending order**. Complete the function `m... |
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 that outputs the transpose of a matrix - a new matrix
where the columns and rows of the original are swapped.
For example, the transpose of:
| 1 2 3 |... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task
In the Land Of Chess, bishops don't really like each other. In fact, when two bishops happen to stand on the same diagonal, they immediately rush towards the opposite ... |
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 that takes a number or a string and gives back the number of **permutations without repetitions** that can generated using all of its element.; more on permut... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write
```python
function combine()
```
that combines arrays by alternatingly taking elements passed to it.
E.g
```python
combine(['a', 'b', 'c'], [1, 2, 3]) == ['a', 1, 'b... |
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 need to write a function that will receive two strings (```n1``` and ```n2```), each representing an integer as a binary number. A third parameter will be pro... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.To pass the series of gates guarded by the owls, Kenneth needs to present them each with a highly realistic portrait of one. Unfortunately, he is absolutely rubbish at drawin... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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"]) # re... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 th... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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.... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# 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**... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## 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:... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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:
```... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 we... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# 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 ta... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.#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 ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.##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 de... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 amo... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 s... |
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 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).
## Exampl... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# 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. I... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 ou... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.---
# 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 ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 ``` ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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**... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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\_... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## 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_oper... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# 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 persona... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 dict... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 p... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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,
``... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# 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... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# 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 ar... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 table... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## 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 "B... |
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 `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.wi... |
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 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 differ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 preservin... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 =... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 digit... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 a... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.> 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 un... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.*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 b... |
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 the second part of a series: [Neighbourhood kata collection](https://www.codewars.com/collections/5b2f4db591c746349d0000ce). If this one is to easy you can try ou... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 `... |
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 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 phon... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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... |
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 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 ta... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 particul... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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.
```
... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# 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... |
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 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 perm... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# 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 addres... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 pl... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.###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... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 li... |
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 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 b... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 Excit... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 n... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 a... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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... |
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 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.... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Convert a hash into an array. Nothing more, Nothing less.
```
{name: 'Jeremy', age: 24, role: 'Software Engineer'}
```
should be converted into
```
[["name", "Jeremy"], ["ag... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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`,... |
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 named setAlarm which receives two parameters. The first parameter, employed, is true whenever you are employed and the second parameter, vacation is true when... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 ... |
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.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 th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.