id stringlengths 11 14 | content stringlengths 424 1.17M |
|---|---|
apps_data_4800 | The Collatz conjecture (also known as 3n+1 conjecture) is a conjecture that applying the following algorithm to any number we will always eventually reach one:
```
[This is writen in pseudocode]
if(number is even) number = number / 2
if(number is odd) number = 3*number + 1
```
#Task
Your task is to make a function `... |
apps_data_4801 | DevOps legacy roasting!
Save the business from technological purgatory.
Convert IT to DevOps, modernize application workloads, take it all to the Cloud…….
You will receive a string of workloads represented by words….some legacy and some modern mixed in with complaints from the business….your job is to burn the legac... |
apps_data_4802 | # Task
Follow the instructions in each failing test case to write logic that calculates the total price when ringing items up at a cash register.
# Purpose
Practice writing maintainable and extendable code.
# Intent
This kata is meant to emulate the real world where requirements change over time. This kata does not ... |
apps_data_4803 | Write a function that takes an array of numbers (integers for the tests) and a target number. It should find two different items in the array that, when added together, give the target value. The indices of these items should then be returned in a tuple like so: `(index1, index2)`.
For the purposes of this kata, some ... |
apps_data_4804 | This kata provides you with a list of parent-child pairs `family_list`, and from this family description you'll need to find the relationship between two members(what is the relation of latter with former) which is given as `target_pair`.
For example, the family list may be given as:
`[('Enid', 'Susan'), ('Susan', 'D... |
apps_data_4805 | You will be given an array `a` and a value `x`. All you need to do is check whether the provided array contains the value.
~~~if:swift
The type of `a` and `x` can be `String` or `Int`.
~~~
~~~if-not:swift
Array can contain numbers or strings. X can be either.
~~~
~~~if:racket
In racket, you'll be given a list instead ... |
apps_data_4806 | The [Linear Congruential Generator (LCG)](https://en.wikipedia.org/wiki/Linear_congruential_generator) is one of the oldest pseudo random number generator functions.
The algorithm is as follows:
## Xn+1=(aXn + c) mod m
where:
* `a`/`A` is the multiplier (we'll be using `2`)
* `c`/`C` is the increment (we'll be using ... |
apps_data_4807 | While developing a website, you detect that some of the members have troubles logging in. Searching through the code you find that all logins ending with a "\_" make problems. So you want to write a function that takes an array of pairs of login-names and e-mails, and outputs an array of all login-name, e-mails-pairs f... |
apps_data_4808 | No description!!!
Input :: [10,20,25,0]
Output :: ["+0", "+10", "+15", "-10"]
`Show some love, rank and upvote!`
def equalize(arr):
return ["{:+d}".format(i-arr[0]) for i in arr]
def equalize(arr):
return [f"{n - arr[0]:+d}" for n in arr]
def equalize(arr):
return [f"{e - arr[0]:+d}" for e in arr]
... |
apps_data_4809 | Introduction
The GADERYPOLUKI is a simple substitution cypher used in scouting to encrypt messages. The encryption is based on short, easy to remember key. The key is written as paired letters, which are in the cipher simple replacement.
The most frequently used key is "GA-DE-RY-PO-LU-KI".
```
G => A
g => a
a =>... |
apps_data_4810 | # Idea
In the world of graphs exists a structure called "spanning tree". It is unique because it's created not on its own, but based on other graphs. To make a spanning tree out of a given graph you should remove all the edges which create cycles, for example:
```
This can become this or this or ... |
apps_data_4811 | Create a `Vector` class with `x` and a `y` attributes that represent component magnitudes in the x and y directions.
Your vectors should handle vector additon with an `.add()` method that takes a second vector as an argument and returns a new vector equal to the sum of the vector you call `.add()` on and the vector yo... |
apps_data_4812 | The [Floyd's triangle](https://en.wikipedia.org/wiki/Floyd%27s_triangle) is a right-angled triangular array of natural numbers listing them in order, in lines of increasing length, so a Floyds triangle of size 6 looks like:
```
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
...
```
In this kata you'r... |
apps_data_4813 | Among the ruins of an ancient city a group of archaeologists found a mysterious function with lots of HOLES in it called ```getNum(n)``` (or `get_num(n)` in ruby, python, or r). They tried to call it with some arguments. And finally they got this journal:
The archaeologists were totally stuck with this challenge. They ... |
apps_data_4814 | Write function isPalindrome that checks if a given string (case insensitive) is a palindrome.
```racket
In Racket, the function is called palindrome?
(palindrome? "nope") ; returns #f
(palindrome? "Yay") ; returns #t
```
def is_palindrome(s):
s = s.lower()
return s == s[::-1]
def is_palindrome(s):
"""r... |
apps_data_4815 | Description:
#Task:
Write a function that returns true if the number is a "Very Even" number.
If a number is a single digit, then it is simply "Very Even" if it itself is even.
If it has 2 or more digits, it is "Very Even" if the sum of it's digits is "Very Even".
#Examples:
```
input(88) => returns false -> 8 + ... |
apps_data_4816 | # Magpies are my favourite birds
Baby ones even more so...
It is a little known fact^ that the black & white colours of baby magpies differ by **at least** one place and **at most** two places from the colours of the mother magpie.
So now you can work out if any two magpies may be related.
*...and Quardle oodle ... |
apps_data_4817 | You must create a function, `spread`, that takes a function and a list of arguments to be applied to that function. You must make this function return the result of calling the given function/lambda with the given arguments.
eg:
```python
spread(someFunction, [1, true, "Foo", "bar"] )
# is the same as...
someFunction... |
apps_data_4818 | Given 2 strings, `a` and `b`, return a string of the form short+long+short, with the shorter string on the outside
and the longer string on the inside. The strings will not be the same length, but they may be empty ( length `0` ).
For example:
```python
solution("1", "22") # returns "1221"
solution("22", "1") # retur... |
apps_data_4819 | When you were little, your mother used to make the most delicious cookies, which you could not resist. So, every now and then, when your mother didn't see you, you sneaked into the kitchen, climbed onto a stool to reach the cookie jar, and stole a cookie or two. However, sometimes while doing this, you would hear foot ... |
apps_data_4820 | Classy Extensions
Classy Extensions, this kata is mainly aimed at the new JS ES6 Update introducing extends keyword. You will be preloaded with the Animal class, so you should only edit the Cat class.
Task
Your task is to complete the Cat class which Extends Animal and replace the speak method to return the cats name ... |
apps_data_4821 | Task:
This kata requires you to write an object that receives a file path
and does operations on it.
NOTE FOR PYTHON USERS: You cannot use modules os.path, glob, and re
The purpose of this kata is to use string parsing, so you're not supposed to import external libraries. I could only enforce this in python.
Testing:
... |
apps_data_4822 | # Introduction
Mastermind or Master Mind is a code-breaking game for two players. The modern game with pegs was invented in 1970 by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert. It resembles an earlier pencil and paper game called Bulls and Cows that may date back a century or more. (Source... |
apps_data_4823 | John wants to decorate a room with wallpaper. He's heard that
making sure he has the right amount of wallpaper is more complex than it sounds.
He wants a fool-proof method for getting it right.
John knows that the rectangular room has a length of `l` meters, a width of `w` meters, a height of `h` meters.
The standar... |
apps_data_4824 | Implement a function that returns the minimal and the maximal value of a list (in this order).
def get_min_max(seq):
return min(seq), max(seq)
def get_min_max(L):
return (min(L),max(L))
get_min_max = lambda seq: (min(seq), max(seq))
def get_min_max(seq):
max = seq[0]
min = seq[0]
for a in seq:... |
apps_data_4825 | You'll be given a string of random characters (numbers, letters, and symbols). To decode this string into the key we're searching for:
(1) count the number occurences of each ascii lowercase letter, and
(2) return an ordered string, 26 places long, corresponding to the number of occurences for each corresponding let... |
apps_data_4826 | ```
------------------------------------------------------------------
we are programmed just to do anything you want us to
w e a r e t h e r o b o t s
-----------------------------------------------------------[ d[(0)(0)]b]
```
Task.....
You will receieve an array of strings
su... |
apps_data_4827 | We have a distribution of probability of a discrete variable (it may have only integer values)
```
x P(x)
0 0.125
1 0.375
2 0.375
3 0.125
Total = 1.000 # The sum of the probabilities for all the possible values should be one (=1)
```
The mean, ```μ```, of the values of x is:
For our ... |
apps_data_4828 | Some numbers can be expressed as a difference of two squares, for example, 20 = 6^(2)-4^(2) and 21 = 5^(2)-2^(2). Many numbers can be written this way, but not all.
## Your Task
Complete the function that takes a positive integer `n` and returns the amount of numbers between `1` and `n` (inclusive) that can be represe... |
apps_data_4829 | __Function composition__ is a mathematical operation that mainly presents itself in lambda calculus and computability. It is explained well [here](http://www.mathsisfun.com/sets/functions-composition.html), but this is my explanation, in simple mathematical notation:
```
f3 = compose( f1 f2 )
Is equivalent to...
f3... |
apps_data_4830 | Part 2/3 of my kata series. [Part 1](http://www.codewars.com/kata/riemann-sums-i-left-side-rule)
The description changes little in this second part. Here we simply want to improve our approximation of the integral by using trapezoids instead of rectangles. The left/right side rules have a serious bias and the trapezoi... |
apps_data_4831 | Tired of those repetitive javascript challenges? Here's a unique hackish one that should keep you busy for a while ;)
There's a mystery function which is already available for you to use. It's a simple function called `mystery`. It accepts a string as a parameter and outputs a string. The exercise depends on guessing ... |
apps_data_4832 | Your task is to find all the elements of an array that are non consecutive.
A number is non consecutive if it is not exactly one larger than the previous element in the array. The first element gets a pass and is never considered non consecutive.
~~~if:javascript,haskell,swift
Create a function named `allNonConsecuti... |
apps_data_4833 | ### Description:
Replace all vowel to exclamation mark in the sentence. `aeiouAEIOU` is vowel.
### Examples
```
replace("Hi!") === "H!!"
replace("!Hi! Hi!") === "!H!! H!!"
replace("aeiou") === "!!!!!"
replace("ABCDE") === "!BCD!"
```
def replace_exclamation(s):
return ''.join('!' if c in 'aeiouAEIOU' else c fo... |
apps_data_4834 | Backwards Read Primes are primes that when read backwards in base 10 (from right to left)
are a different prime. (This rules out primes which are palindromes.)
```
Examples:
13 17 31 37 71 73 are Backwards Read Primes
```
13 is such because it's prime and read from right to left writes 31 which is prime too. Same for ... |
apps_data_4835 | We've got a message from the **Librarian**. As usual there're many `o` and `k` in it and, as all codewarriors don't know "Ook" language we need that you translate this message.
**tip** : it seems traditional "Hello World!" would look like :
`Ok, Ook, Ooo? Okk, Ook, Ok? Okk, Okk, Oo? Okk, Okk, Oo? Okk, Okkkk? Ok, ... |
apps_data_4836 | Complete the function so that it returns the number of seconds that have elapsed between the start and end times given.
##### Tips:
- The start/end times are given as Date (JS/CoffeeScript), DateTime (C#), Time (Nim), datetime(Python) and Time (Ruby) instances.
- The start time will always be before the end time.
... |
apps_data_4837 | Time to build a crontab parser... https://en.wikipedia.org/wiki/Cron
A crontab command is made up of 5 fields in a space separated string:
```
minute: 0-59
hour: 0-23
day of month: 1-31
month: 1-12
day of week: 0-6 (0 == Sunday)
```
Each field can be a combination of the following values:
* a wildcard `*` which equ... |
apps_data_4838 | # Description
You are required to implement a function `find_nth_occurrence` that returns the index of the nth occurrence of a substring within a string (considering that those substring could overlap each others). If there are less than n occurrences of the substring, return -1.
# Example
```python
string = "This is ... |
apps_data_4839 | The accounts of the "Fat to Fit Club (FFC)" association are supervised by John as a volunteered accountant.
The association is funded through financial donations from generous benefactors. John has a list of
the first `n` donations: `[14, 30, 5, 7, 9, 11, 15]`
He wants to know how much the next benefactor should give t... |
apps_data_4840 | This Kata is the first in the [Rubiks Cube collection](https://www.codewars.com/collections/rubiks-party).
[This](https://ruwix.com/the-rubiks-cube/notation/) or [this](https://ruwix.com/the-rubiks-cube/notation/advanced/) websites will be very usefull for this kata, if there will be some lack of understanding after t... |
apps_data_4841 | An integral:
can be approximated by the so-called Simpson’s rule:
Here `h = (b-a)/n`, `n` being an even integer and `a <= b`.
We want to try Simpson's rule with the function f:
The task is to write a function called `simpson` with parameter `n` which returns the value of the integral of f on the interval ... |
apps_data_4842 | Mutation is a genetic operator used to maintain genetic diversity from one generation of a population of genetic algorithm chromosomes to the next.

A mutation here may happen on zero or more positions in a chromosome. It is going to check every position and by a given proba... |
apps_data_4843 | John and Mary want to travel between a few towns A, B, C ... Mary has on a sheet of paper a list of distances between these towns.
`ls = [50, 55, 57, 58, 60]`.
John is tired of driving and he says to Mary that he doesn't want to drive more than `t = 174 miles` and he
will visit only `3` towns.
Which distances, hence w... |
apps_data_4844 | In this kata you are expected to recover a scattered password in a (m x n) grid (you'll be given directions of all password pieces in the array)
The array will contain pieces of the password to be recovered, you'll get directions on how to get all the the pieces, your initial position in the array will be the characte... |
apps_data_4845 | You get some nested lists. Keeping the original structures, sort only elements (integers) inside of the lists. In other words, sorting the intergers only by swapping their positions.
```
Example
Input : [[[2, 1], [4, 3]], [[6, 5], [8, 7]]]
Output : [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
```
Note:
The structures o... |
apps_data_4846 | Create a function that returns the total of a meal including tip and tax. You should not tip on the tax.
You will be given the subtotal, the tax as a percentage and the tip as a percentage. Please round your result to two decimal places.
def calculate_total(subtotal, tax, tip):
return round(subtotal * ( 1 + tax /... |
apps_data_4847 | # Task
Imagine a white rectangular grid of `n` rows and `m` columns divided into two parts by a diagonal line running from the upper left to the lower right corner. Now let's paint the grid in two colors according to the following rules:
```
A cell is painted black if it has at least one point in common with the diag... |
apps_data_4848 | ## Description
Welcome, Warrior! In this kata, you will get a message and you will need to get the frequency of each and every character!
## Explanation
Your function will be called `char_freq`/`charFreq`/`CharFreq` and you will get passed a string, you will then return a dictionary (object in JavaScript) with as ke... |
apps_data_4849 | Quite recently it happened to me to join some recruitment interview, where my first task was to write own implementation of built-in split function. It's quite simple, is it not?
However, there were the following conditions:
* the function **cannot** use, in any way, the original `split` or `rsplit` functions,
* the ... |
apps_data_4850 | Given the moleculer mass of two molecules ( __M1__ and __M2__ ), their masses present ( __m1__ and __m2__ ) in a vessel of volume ( __V__ ) at a specific temperature ( __T__ ). Find the total pressure exerted by the molecules ( __Ptotal__ ) .
input
====
Six values :
- __m1__
- __m2__
- __M1__
- __M2__
- __V__
- __T... |
apps_data_4851 | ### Background
One way to order a nested (reddit-style) commenting system is by giving each comment a rank.
Generic comments on a thread start with rank 1 and increment, so the second comment on a thread would have rank 2. A reply to comment 1 will be ranked 1.1, and a reply to comment 1.1 will be ranked 1.1.1 . The ... |
apps_data_4852 | # Task
Make a custom esolang interpreter for the language Stick. Stick is a simple, stack-based esoteric programming language with only 7 commands.
# Commands
* `^`: Pop the stack.
* `!`: Add new element to stack with the value of 0.
* `+`: Increment element. 255+1=0.
* `-`: Decrement element. 0-1=255.
* `*`: Add ... |
apps_data_4853 | Given a string, you have to return a string in which each character (case-sensitive) is repeated once.
```python
double_char("String") ==> "SSttrriinngg"
double_char("Hello World") ==> "HHeelllloo WWoorrlldd"
double_char("1234!_ ") ==> "11223344!!__ "
```
Good Luck!
def double_char(s):
return ''.join(c * 2 fo... |
apps_data_4854 | A circle is defined by three coplanar points that are not aligned.
You will be given a list of circles and a point [xP, yP]. You have to create a function, ```count_circles()``` (Javascript ```countCircles()```), that will count the amount of circles that contains the point P inside (the circle border line is included... |
apps_data_4855 | This kata is the first of a sequence of four about "Squared Strings".
You are given a string of `n` lines, each substring being `n` characters long: For example:
`s = "abcd\nefgh\nijkl\nmnop"`
We will study some transformations of this square of strings.
- Vertical mirror:
vert_mirror (or vertMirror or vert-mirror)... |
apps_data_4856 | Inspired by [Round to the next 5](/kata/55d1d6d5955ec6365400006d).
Warning! This kata contains spoilers on the mentioned one. Solve that one first!
# The Coins of Ter
Ter is a small country, located between Brelnam and the Orange juice ocean. It uses many different coins and bills for payment. However, one day, the le... |
apps_data_4857 | This is a question from codingbat
Given an integer n greater than or equal to 0,
create and return an array with the following pattern:
squareUp(3) => [0, 0, 1, 0, 2, 1, 3, 2, 1]
squareUp(2) => [0, 1, 2, 1]
squareUp(4) => [0, 0, 0, 1, 0, 0, 2, 1, 0, 3, 2, 1, 4, 3, 2, 1]
n<=1000.
# Check out my other kata... |
apps_data_4858 | John and his wife Ann have decided to go to Codewars.
On first day Ann will do one kata and John - he wants to know how it is working - 0 kata.
Let us call `a(n)` - and `j(n)` - the number of katas done by Ann - and John - at day `n`. We have `a(0) = 1` and in the same manner `j(0) = 0`.
They have chosen the follow... |
apps_data_4859 | The special score(ssc) of an array of integers will be the sum of each integer multiplied by its corresponding index plus one in the array.
E.g.: with the array ```[6, 12, -1]```
```
arr = [6, 12, -1 ]
ssc = 1*6 + 2* 12 + 3.(*1) = 6 + 24 - 3 = 27
```
The array given in the example has six(6) permuta... |
apps_data_4860 | Amidakuji is a method of lottery designed to create random pairings between two sets comprised of an equal number of elements.
Your task is to write a function amidakuji that returns the final positions of each element. Note that the elements are an ascending sequence of consecutive integers starting with 0 (from left ... |
apps_data_4861 | Write a function getNumberOfSquares that will return how many integer (starting from 1, 2...) numbers raised to power of 2 and then summed up are less than some number given as a parameter.
E.g 1: For n = 6 result should be 2 because 1^2 + 2^2 = 1 + 4 = 5 and 5 < 6
E.g 2: For n = 15 result should be 3 because 1^2 + 2... |
apps_data_4862 | The cat wants to lay down on the table, but the problem is that we don't know where it is in the room!
You'll get in input:
- the cat coordinates as a list of length 2, with the row on the map and the column on the map.
- the map of the room as a list of lists where every element can be 0 if empty or 1 if is the tab... |
apps_data_4863 | An array is **circularly sorted** if the elements are sorted in ascending order, but displaced, or rotated, by any number of steps.
Complete the function/method that determines if the given array of integers is circularly sorted.
## Examples
These arrays are circularly sorted (`true`):
```
[2, 3, 4, 5, 0, 1] ... |
apps_data_4864 | # Description:
Remove the minimum number of exclamation marks from the start/end of each word in the sentence to make their amount equal on both sides.
### Notes:
* Words are separated with spaces
* Each word will include at least 1 letter
* There will be no exclamation marks in the middle of a word
___
## Examples... |
apps_data_4865 | Implement a function which multiplies two numbers.
def multiply(x, y):
return x * y
multiply = lambda x, y: x * y
def multiply(a,b):
return a * b
from operator import mul as multiply
def multiply(is_this, a_joke): return is_this*a_joke
multiply = lambda a,b: a*b
def multiply(term_one, term_two):
retu... |
apps_data_4866 | #Split all even numbers to odd ones in different ways
Your task is to split all even numbers from an array to odd ones. So your method has to return a new array with only odd numbers.
For "splitting" the numbers there are four ways.
```
0 -> Split into two odd numbers, that are closest to each other.
(e.g.: 8 -... |
apps_data_4867 | # Task
Given two cells on the standard chess board, determine whether they have the same color or not.
# Example
For `cell1 = "A1" and cell2 = "C3"`, the output should be `true`.
For `cell1 = "A1" and cell2 = "H3"`, the output should be `false`.
# Input/Output
- `[input]` string `cell1`
- `[input]` string `c... |
apps_data_4868 | As you see in Example test cases, the os running this service is ```posix```.
Return the output by executing the command given as the string on posix os.
See the example test cases for the expected data format.
import os
def get_output(s):
return os.popen(s).read()
from subprocess import check_output
def get_... |
apps_data_4869 | # Context
According to Wikipedia : "The seventh son of a seventh son is a concept from folklore regarding special powers given to, or held by, such a son. **The seventh son must come from an unbroken line with no female siblings born between, and be, in turn, born to such a seventh son.**"
# Your task
You will be gi... |
apps_data_4870 | The year is 2088 and the Radical Marxist Socialist People's Party (RMSPP) has just seized power in Brazil.
Their first act in power is absolute wealth equality through coercive redistribution.
Create a function that redistributes all wealth equally among all citizens.
Wealth is represented as an array/list where eve... |
apps_data_4871 | Write a function that takes a piece of text in the form of a string and returns the letter frequency count for the text. This count excludes numbers, spaces and all punctuation marks. Upper and lower case versions of a character are equivalent and the result should all be in lowercase.
The function should return a lis... |
apps_data_4872 | # Story
You were supposed to implement a node-based calculator. Hopefully for you, a colleague agreed to do the task. When the management saw the code, they were infuriated with its low quality, and as a punishment told you to shorten it as much as possible...
___
# Task
You will be given a ready solution passing a... |
apps_data_4873 | This series of katas will introduce you to basics of doing geometry with computers.
`Point` objects have `x`, `y`, and `z` attributes. For Haskell there are `Point` data types described with record syntax with fields `x`, `y`, and `z`.
Write a function calculating distance between `Point a` and `Point b`.
Tests rou... |
apps_data_4874 | A traveling salesman has to visit clients. He got each client's address e.g. `"432 Main Long Road St. Louisville OH 43071"` as a list.
The basic zipcode format usually consists of two capital letters followed by a white space and five digits.
The list of clients to visit was given as a string of all addresses, each se... |
apps_data_4875 | You need to create a function that will validate if given parameters are valid geographical coordinates.
Valid coordinates look like the following: __"23.32353342, -32.543534534"__.
The return value should be either __true__ or __false__.
Latitude (which is first float) can be between 0 and 90, positive or negative.
... |
apps_data_4876 | Define a method ```hello``` that ```returns``` "Hello, Name!" to a given ```name```, or says Hello, World! if name is not given (or passed as an empty String).
Assuming that ```name``` is a ```String``` and it checks for user typos to return a name with a first capital letter (Xxxx).
Examples:
def hello(name=''):
... |
apps_data_4877 | According to Gary Chapman, marriage counselor and the author of ["The Five Love Languages"](https://en.wikipedia.org/wiki/The_Five_Love_Languages) books, there are five major ways to express our love towards someone: *words of affirmation, quality time, gifts, acts of service,* and *physical touch*. These are called th... |
apps_data_4878 | My third kata, write a function `check_generator` that examines the status of a Python generator expression `gen` and returns `'Created'`, `'Started'` or `'Finished'`. For example:
`gen = (i for i in range(1))` >>> returns `'Created'` (the generator has been initiated)
`gen = (i for i in range(1)); next(gen, None)` >... |
apps_data_4879 | When we have a 2x2 square matrix we may have up to 24 different ones changing the positions of the elements.
We show some of them
```
a b a b a c a c a d a d b a b a
c d d c d b b d b c c b c d d c
```
You may think to generate the remaining ones until completing t... |
apps_data_4880 | What is the answer to life the universe and everything
Create a function that will make anything true
```python
anything({}) != [], 'True'
anything('Hello') < 'World', 'True'
anything(80) > 81, 'True'
anything(re) >= re, 'True'
anything(re) <= math, 'True'
an... |
apps_data_4881 | You must create a method that can convert a string from any format into CamelCase. This must support symbols too.
*Don't presume the separators too much or you could be surprised.*
### Tests
```python
camelize("example name") # => ExampleName
camelize("your-NaMe-here") # => YourNameHere
camelize("testing ABC") #... |
apps_data_4882 | Given an integer as input, can you round it to the next (meaning, "higher") multiple of 5?
Examples:
input: output:
0 -> 0
2 -> 5
3 -> 5
12 -> 15
21 -> 25
30 -> 30
-2 -> 0
-5 -> -5
etc.
Input may be any positive or negative integer (inclu... |
apps_data_4883 | Get the next prime number!
You will get a number`n` (>= 0) and your task is to find the next prime number.
Make sure to optimize your code: there will numbers tested up to about `10^12`.
## Examples
```
5 => 7
12 => 13
```
from itertools import count
def is_prime(n):
if n < 2: return False
if n == 2... |
apps_data_4884 | # Kata Task
Connect the dots in order to make a picture!
# Notes
* There are 2-26 dots labelled `a` `b` `c` ...
* The line char is `*`
* Use only straight lines - vertical, horizontal, or diagonals of a square
* The paper is rectangular - `\n` terminates every line
* All input is valid
# Examples
InputExpected
... |
apps_data_4885 | # Find the gatecrashers on CocoBongo parties
CocoBongo is a club with very nice parties. However, you only can get inside if you know at least one other guest. Unfortunately, some gatecrashers can appear at those parties. The gatecrashers do not know any other party member and should not be at our amazing party!
We w... |
apps_data_4886 | This challenge is an extension of the kata of Codewars: **Missing and Duplicate Number"**, authored by the user **Uraza**. (You may search for it and complete it if you have not done it)
In this kata, we have an unsorted sequence of consecutive numbers from ```a``` to ```b```, such that ```a < b``` always (remember ... |
apps_data_4887 | The date is March 24, 2437 and the the Earth has been nearly completely destroyed by the actions of its inhabitants. Our last hope in this disaster lies in a shabby time machine built from old toasters and used microwave parts.
The World Time Agency requires you to travel back in time to prevent disaster. You are o... |
apps_data_4888 | Return the `n`th term of the Recamán's sequence.
```
a(0) = 0;
a(n-1) - n, if this value is positive and not yet in the sequence
/
a(n) <
\
a(n-1) + n, otherwise
```
___
A video about Recamán's sequence by Numberphile: https://www.youtube.com/watch?v=FGC5TdIiT9U
def recaman(n):
seri... |
apps_data_4889 | In this kata, your task is to find the maximum sum of any straight "beam" on a hexagonal grid, where its cell values are determined by a finite integer sequence seq.
In this context, a beam is a linear sequence of cells in any of the 3 pairs of opposing sides of a hexagon. We'll refer to the sum of a beam's integer val... |
apps_data_4890 | In this simple exercise, you will create a program that will take two lists of integers, ```a``` and ```b```. Each list will consist of 3 positive integers above 0, representing the dimensions of cuboids ```a``` and ```b```. You must find the difference of the cuboids' volumes regardless of which is bigger.
For exampl... |
apps_data_4891 | Your task is to build a model^(1) which can predict y-coordinate.
You can pass tests if predicted y-coordinates are inside error margin.
You will receive train set which should be used to build a model.
After you build a model tests will call function ```predict``` and pass x to it.
Error is going to be calculated ... |
apps_data_4892 | We need a function that may receive a list of an unknown amount of points in the same plane, having each of them, cartesian coordinates of the form (x, y) and may find the biggest triangle (the one with the largest area) formed by all of the possible combinations of groups of three points of that given list.
Of course... |
apps_data_4893 | A list of integers is sorted in “Wave” order if alternate items are not less than their immediate neighbors (thus the other alternate items are not greater than their immediate neighbors).
Thus, the array `[4, 1, 7, 5, 6, 2, 3]` is in **Wave** order because 4 >= 1, then 1 <= 7, then 7 >= 5, then 5 <= 6, then 6 >= 2, a... |
apps_data_4894 | Write function `makeParts` or `make_parts` (depending on your language) that will take an array as argument and the size of the chunk.
Example: if an array of size 123 is given and chunk size is 10 there will be 13 parts, 12 of size 10 and 1 of size 3.
def makeParts(arr, csize):
return [ arr[i: i + csize] for i in ... |
apps_data_4895 | [XKCD 1609]( http://xkcd.com/1609/) provides us with the following fun fact:

### Task:
Given an array containing a list of good foods, return a strin... |
apps_data_4896 | The goal of this kata is to implement [trie](https://en.wikipedia.org/wiki/Trie) (or prefix tree) using dictionaries (aka hash maps or hash tables), where:
1. the dictionary keys are the prefixes
2. the value of a leaf node is `None` in Python, `nil` in Ruby and `null` in Groovy, JavaScript and Java.
3. the value for ... |
apps_data_4897 | The objective is to write a method that takes two integer parameters and returns a single integer equal to the number of 1s in the binary representation of the greatest common divisor of the parameters.
Taken from Wikipedia:
"In mathematics, the greatest common divisor (gcd) of two or more integers, when at least one... |
apps_data_4898 | Brief
=====
In this easy kata your function has to take a **string** as input and **return a string** with everything removed (*whitespaces* included) but the **digits**. As you may have guessed **empty strings** are to be returned as they are & if the input string contains no digits then the output will be an **empty ... |
apps_data_4899 | An architect wants to construct a vaulted building supported by a family of arches Cn.
fn(x) = -nx - xlog(x) is the equation of the arch Cn where `x` is a positive real number (0 < x <= 1), `log(x)` is the natural logarithm (base e), `n` a non negative integer. Let fn(0) = 0.
Be An the point of Cn where the tangent t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.