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.# Task Consider a string of lowercase Latin letters and space characters (" "). First, rearrange the letters in each word `alphabetically`. And then rearrange the wor...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.I need some help with my math homework. I have a number of problems I need to return the derivative for. They will all be of the form: ax^b, A and B are both integers, bu...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.There are some stones on Bob's table in a row, and each of them can be red, green or blue, indicated by the characters `R`, `G`, and `B`. Help Bob find the minimum number of ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create the function ```consecutive(arr)``` that takes an array of integers and return the minimum number of integers needed to make the contents of ```arr``` consecutive from ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.I have the `par` value for each hole on a golf course and my stroke `score` on each hole. I have them stored as strings, because I wrote them down on a sheet of paper. Right ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The written representation of a number (with 4 or more digits) can be split into three parts in various different ways. For example, the written number 1234 can be split as [1...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Summary: Given a number, `num`, return the shortest amount of `steps` it would take from 1, to land exactly on that number. # Description: A `step` is defined as either: - ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Consider integer coordinates x, y in the Cartesian plan and three functions f, g, h defined by: ``` f: 1 <= x <= n, 1 <= y <= n --> f(x, y) = min(x, y) g: 1 <= x <= n, 1 <= y ...
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, your task is to create a function that takes a single list as an argument and returns a flattened list. The input list will have a maximum of one level of nestin...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Have you heard about Megamind? Megamind and Metro Man are two aliens who came to earth. Megamind wanted to destroy the earth, while Metro Man wanted to stop him and protect ma...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A new task for you! You have to create a method, that corrects a given time string. There was a problem in addition, so many of the time strings are broken. Time-Format is eu...
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 which returns the weekday according to the input number: * `1` returns `"Sunday"` * `2` returns `"Monday"` * `3` returns `"Tuesday"` * `4` returns `"Wed...
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 n rectangular boxes, the ith box has the length lengthi, the width widthi and the height heighti. Your task is to check if it is possible to pack all...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Welcome. In this kata you are required to, given a string, replace every letter with its position in the alphabet. If anything in the text isn't a letter, ignore it and don'...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.All of the animals are having a feast! Each animal is bringing one dish. There is just one rule: the dish must start and end with the same letters as the animal's name. For ex...
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 rearranges an integer into its largest possible value. ```python super_size(123456) # 654321 super_size(105) # 510 super_size(12) # 21 ``` ``` h...
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 string and returns an array of the repeated characters (letters, numbers, whitespace) in the string. If a charater is repeated more than once, o...
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 positive integer as input, return the output as a string in the following format: Each element, corresponding to a digit of the number, multiplied by a powe...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A Narcissistic Number is a number of length n in which the sum of its digits to the power of n is equal to the original number. If this seems confusing, refer to the example b...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In a small town the population is `p0 = 1000` at the beginning of a year. The population regularly increases by `2 percent` per year and moreover `50` new inhabitants per year...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task N lamps are placed in a line, some are switched on and some are off. What is the smallest number of lamps that need to be switched so that on and off lamps will alterna...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A population of bears consists of black bears, brown bears, and white bears. The input is an array of two elements. Determine whether the offspring of the two bears will re...
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 game developer and have programmed the #1 MMORPG(Massively Multiplayer Online Role Playing Game) worldwide!!! Many suggestions came across you to make t...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Timothy (age: 16) really likes to smoke. Unfortunately, he is too young to buy his own cigarettes and that's why he has to be extremely efficient in smoking. It's now your ta...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Find the closest prime number under a certain integer ```n``` that has the maximum possible amount of even digits. For ```n = 1000```, the highest prime under ```1000``` is `...
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, write a function to output its reverse digits. (e.g. given 123 the answer is 321) Numbers should preserve their sign; i.e. a negative number should still be...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Hello everyone. I have a simple challenge for you today. In mathematics, the formula for finding the sum to infinity of a geometric sequence is: **ONLY IF** `-1 < r < 1` ...
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 (or list or vector) of arrays (or, guess what, lists or vectors) of integers, your goal is to return the sum of a specific set of numbers, starting with element...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Write a simple parser that will parse and run Deadfish. Deadfish has 4 commands, each 1 character long: * `i` increments the value (initially `0`) * `d` decrements the valu...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Imagine there's a big cube consisting of n^3 small cubes. Calculate, how many small cubes are not visible from outside. For example, if we have a cube which has 4 cubes in a ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Task Given array of integers `sequence` and some integer `fixedElement`, output the number of `even` values in sequence before the first occurrence of `fixedElement` or `-1`...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Description You are a *Fruit Ninja*, your skill is cutting fruit. All the fruit will be cut in half by your knife. For example: ``` [ "apple", "pear", "banana" ]...
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 called calculate that takes 3 values. The first and third values are numbers. The second value is a character. If the character is "+" , "-", "*", or "/", the...
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 and an integer (`n`). The function should return a string that repeats the input string `n` number of times. If anything other than a s...
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 single array as an argument (containing multiple strings and/or positive numbers and/or arrays), and returns one of four possible string values, ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.`Description:` Given an input array (`arr`) of positive integers, the objective is to return an output array where each index represents the amount of times an element appear...
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 list/array which contains only integers (positive and negative). Your job is to sum only the numbers that are the same and consecutive. The result should be on...
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 two strings `a` and `b` and your task will be to return the characters that are not common in the two strings. For example: ```Haskell solve(...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You're looking through different hex codes, and having trouble telling the difference between #000001 and #100000 We need a way to tell which is red, and which is blue! ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Our football team finished the championship. The result of each match look like "x:y". Results of all matches are recorded in the collection. For example: ```["3:1", "2:2", "...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.I've got a crazy mental illness. I dislike numbers a lot. But it's a little complicated: The number I'm afraid of depends on which day of the week it is... This is a concrete ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The hamming distance of two equal-length strings is the number of positions, in which the two string differ. In other words, the number of character substitutions required to ...
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 one's and zero's that represents a positive binary number convert the number to two's complement value. Two's complement is the way most computers represent...
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 Roman numeral as its argument and returns its value as a numeric decimal integer. You don't need to validate the form of the Roman numeral. Mod...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You get any card as an argument. Your task is to return a suit of this card. Our deck (is preloaded): ```python DECK = ['2S','3S','4S','5S','6S','7S','8S','9S','10S','JS','QS...
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 words (x), for each word within the string you need to turn the word 'inside out'. By this I mean the internal letters will move out, and the externa...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Well met with Fibonacci bigger brother, AKA Tribonacci. As the name may already reveal, it works basically like a Fibonacci, but summing the last 3 (instead of 2) numbers of ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.When you want to get the square of a binomial of two variables x and y, you will have: `$(x+y)^2 = x^2 + 2xy + y ^2$` And the cube: `$(x+y)^3 = x^3 + 3x^2y + 3xy^2 +y^3$` ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Share price =========== You spent all your saved money to buy some shares. You bought it for `invested`, and want to know how much it's worth, but all the info you can quick...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create an identity matrix of the specified size( >= 0). Some examples: ``` (1) => [[1]] (2) => [ [1,0], [0,1] ] [ [1,0,0,0,0], [0,1,0,0,0], (5) ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.In your class, you have started lessons about geometric progression. Since you are also a programmer, you have decided to write a function that will print first `n` elements o...
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 accepts 3 inputs, a string, a starting location, and a length. The function needs to simulate the string endlessly repeating in both directions and ret...
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 takes CamelCase string and returns the string in snake_case notation. Lowercase characters can be numbers. If method gets number, it sh...
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 will check whether the permutation of an input string is a palindrome. Bonus points for a solution that is efficient and/or that uses _only_ built-in lan...
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: `0,1,2,3,4,5,6,7,8,9,10,22,11,20,13,24...`There is nothing special between numbers `0` and `10`. Let's start with the number `10` and derive ...
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 numbers. For each number in the array you will need to create an object. The object key will be the number, as a string. The value will be the...
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 must convert integers numbers from and to a negative-base binary system. Negative-base systems can accommodate all the same numbers as standard place-value s...
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 find the number couple with the greatest difference from a given array of number-couples. All number couples will be given as strings and all numbers in them...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Make a program that takes a value (x) and returns "Bang" if the number is divisible by 3, "Boom" if it is divisible by 5, "BangBoom" if it divisible by 3 and 5, and "Miss" if ...
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 returns the index of the first occurence of the word "Wally". "Wally" must not be part of another word, but it can be directly followed by a punctuation...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Rick wants a faster way to get the product of the largest pair in an array. Your task is to create a performant solution to find the product of the largest two integers in a u...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Vasya wants to climb up a stair of certain amount of steps (Input parameter 1). There are 2 simple rules that he has to stick to. 1. Vasya can climb 1 or 2 steps at each move...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.**DESCRIPTION:** Your strict math teacher is teaching you about right triangles, and the Pythagorean Theorem --> a^2 + b^2 = c^2 whereas a and b are the legs of the right t...
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 integer `n` and your task will be to return `the largest integer that is <= n and has the highest digit sum`. For example: ``` solve(100) =...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.A number is simply made up of digits. The number 1256 is made up of the digits 1, 2, 5, and 6. For 1256 there are 24 distinct permutations of the digits: 1256, 1265, 162...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.*SCHEDULE YOUR DA(RRA)Y* The best way to have a productive day is to plan out your work schedule. Given the following three inputs, please create an an array of time ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Steve and Josh are bored and want to play something. They don't want to think too much, so they come up with a really simple game. Write a function called winner and figure ou...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Your task You are given a dictionary/hash/object containing some languages and your test results in the given languages. Return the list of languages where your test score...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Truncate the given string (first argument) if it is longer than the given maximum length (second argument). Return the truncated string with a `"..."` ending. Note that inser...
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 `consonantCount`, `consonant_count` or `ConsonantCount` that takes a string of English-language text and returns the number of consonants in the string. Cons...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Convert integers to binary as simple as that. You would be given an integer as a argument and you have to return its binary form. To get an idea about how to convert a decimal...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Basic regex tasks. Write a function that takes in a numeric code of any length. The function should check if the code begins with 1, 2, or 3 and return `true` if so. Return `f...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The image shows how we can obtain the Harmonic Conjugated Point of three aligned points A, B, C. - We choose any point L, that is not in the line with A, B and C. We form the...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.We have the number ```12385```. We want to know the value of the closest cube but higher than 12385. The answer will be ```13824```. Now, another case. We have the number ```...
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 remind/show you, how Z-algorithm works and test your implementation. For a string str[0..n-1], Z array is of same length as string. An element Z[i...
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 an input String and returns a String, where all the uppercase words of the input String are in front and all the lowercase words at the end. The o...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Gray code is a form of binary encoding where transitions between consecutive numbers differ by only one bit. This is a useful encoding for reducing hardware data hazards with ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are going to be given a string. Your job is to return that string in a certain order that I will explain below: Let's say you start with this: `012345` The first thing y...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.You are trying to cross a river by jumping along stones. Every time you land on a stone, you hop forwards by the value of that stone. If you skip *over* a stone then its value...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Check if given numbers are prime numbers. If number N is prime ```return "Probable Prime"``` else ``` return "Composite"```. HINT: Upper bount is really big so you should us...
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 an array of integers `a` and a non-negative number of operations `k`, applied to the array. Each operation consists of two parts: ``` find the maximum el...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Let’s get to know our hero: Agent #134 - Mr. Slayer. He was sent by his CSV agency to Ancient Rome in order to resolve some important national issues. However, something incr...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Why would we want to stop to only 50 shades of grey? Let's see to how many we can go. Write a function that takes a number n as a parameter and return an array containing n ...
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 operation: We take a positive integer `n` and replace it with the sum of its `prime factors` (if a prime number is presented multiple times i...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Mothers arranged a dance party for the children in school. At that party, there are only mothers and their children. All are having great fun on the dance floor when suddenly ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Create a __moreZeros__ function which will __receive a string__ for input, and __return an array__ (or null terminated string in C) containing only the characters from that st...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.## Sum Even Fibonacci Numbers * Write a func named SumEvenFibonacci that takes a parameter of type int and returns a value of type int * Generate all of the Fibonacci number...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Your task Oh no... more lemmings!! And in Lemmings Planet a huge battle is being fought between the two great rival races: the green lemmings and the blue lemmings. Everybod...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.We have a matrix of integers with m rows and n columns. We want to calculate the total sum for the matrix: As you can see, the name "alternating sum" of the title is due...
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 of unique numbers. The numbers represent points. The higher the number the higher the points. In the array [1,3,2] 3 is the highest point value so it ...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Letterss of Natac In a game I just made up that doesn’t have anything to do with any other game that you may or may not have played, you collect resources on each turn and t...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.# Do names have colors? *Now they do.* Make a function that takes in a name (Any string two chars or longer really, but the name is the idea) and use the ascii values of it'...
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 integers, count how many times that integer repeats itself, then return a string showing the count and the integer. Example: `countMe('1123')` (`count_me` ...
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 a lifelong fan of your local football club, and proud to say you rarely miss a game. Even though you're a superfan, you still hate boring games. Luckily, boring...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.The [Ones' Complement](https://en.wikipedia.org/wiki/Ones%27_complement) of a binary number is the number obtained by swapping all the 0s for 1s and all the 1s for 0s. For exa...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Mr. Khalkhoul, an amazing teacher, likes to answer questions sent by his students via e-mail, but he often doesn't have the time to answer all of them. In this kata you will h...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Consider the string `"adfa"` and the following rules: ```Pearl a) each character MUST be changed either to the one before or the one after in alphabet. b) "a" can only be ch...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Flash has invited his nemesis The Turtle (He actually was a real villain! ) to play his favourite card game, SNAP. In this game a 52 card deck is dealt out so both Flash and t...
user: Generate an executable Python function generated from the given prompt. Return the function body without invoking it at the final solution.Having two standards for a keypad layout is inconvenient! Computer keypad's layout: Cell phone keypad's layout: Solve the horror of unstandartized keypads by provi...
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 an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number. Example: ```python create_phon...