id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_3300
In input string ```word```(1 word): * replace the vowel with the nearest left consonant. * replace the consonant with the nearest right vowel. P.S. To complete this task imagine the alphabet is a circle (connect the first and last element of the array in the mind). For example, 'a' replace with 'z', 'y' with 'a', etc....
apps_data_3301
Give the summation of all even numbers in a Fibonacci sequence up to, but not including, the maximum value. The Fibonacci sequence is a series of numbers where the next value is the addition of the previous two values. The series starts with 0 and 1: 0 1 1 2 3 5 8 13 21... For example: ```python eve_fib(0)==0 eve_fi...
apps_data_3302
# Task Define crossover operation over two equal-length strings A and B as follows: the result of that operation is a string of the same length as the input strings result[i] is chosen at random between A[i] and B[i]. Given array of strings `arr` and a string result, find for how many pairs of strings from `arr`...
apps_data_3303
Given a mixed array of number and string representations of integers, add up the string integers and subtract this from the total of the non-string integers. Return as a number. def div_con(lst): return sum(n if isinstance(n, int) else -int(n) for n in lst) def div_con(x): return sum([a for a in x if isinst...
apps_data_3304
An array is defined to be `inertial`if the following conditions hold: ``` a. it contains at least one odd value b. the maximum value in the array is even c. every odd value is greater than every even value that is not the maximum value. ``` eg:- ``` So [11, 4, 20, 9, 2, 8] is inertial because a. it contains at leas...
apps_data_3305
## TL;DR Given a number of vertices `N` and a list of weighted directed edges in a directed acyclic graph (each edge is written as `[start, end, weight]` where `from < to`), compute the weight of the shortest path from vertex `0` to vertex `N - 1`. If there is no such path, return `-1`. ## Background A weighted DAG...
apps_data_3306
You will be given two strings `a` and `b` consisting of lower case letters, but `a` will have at most one asterix character. The asterix (if any) can be replaced with an arbitrary sequence (possibly empty) of lowercase letters. No other character of string `a` can be replaced. If it is possible to replace the asterix i...
apps_data_3307
Freddy has a really fat left pinky finger, and every time Freddy tries to type an ```A```, he accidentally hits the CapsLock key! Given a string that Freddy wants to type, emulate the keyboard misses where each ```A``` supposedly pressed is replaced with CapsLock, and return the string that Freddy actually types. It d...
apps_data_3308
In telecomunications we use information coding to detect and prevent errors while sending data. A parity bit is a bit added to a string of binary code that indicates whether the number of 1-bits in the string is even or odd. Parity bits are used as the simplest form of error detecting code, and can detect a 1 bit err...
apps_data_3309
## Overview Resistors are electrical components marked with colorful stripes/bands to indicate both their resistance value in ohms and how tight a tolerance that value has. If you did my Resistor Color Codes kata, you wrote a function which took a string containing a resistor's band colors, and returned a string identi...
apps_data_3310
Your task is to determine the top 3 place finishes in a pole vault competition involving several different competitors. This is isn't always so simple, and it is often a source of confusion for people who don't know the actual rules. Here's what you need to know: As input, you will receive an array of objects. Each o...
apps_data_3311
Reverse and invert all integer values in a given list. Python: reverse_invert([1,12,'a',3.4,87,99.9,-42,50,5.6]) = [-1,-21,-78,24,-5] Ignore all other types than integer. from math import copysign as sign def reverse_invert(lst): return [-int(sign(int(str(abs(x))[::-1]),x)) for x in lst if isinstance(...
apps_data_3312
An anagram is a word, a phrase, or a sentence formed from another by rearranging its letters. An example of this is "angel", which is an anagram of "glean". Write a function that receives an array of words, and returns the total number of distinct pairs of anagramic words inside it. Some examples: - There are 2 anag...
apps_data_3313
# RoboScript #1 - Implement Syntax Highlighting ## Disclaimer The story presented in this Kata Series is purely fictional; any resemblance to actual programming languages, products, organisations or people should be treated as purely coincidental. ## About this Kata Series This Kata Series is based on a fictional s...
apps_data_3314
In this Kata, you will be given two numbers, `a` and `b`, and your task is to determine if the first number `a` is divisible by `all` the prime factors of the second number `b`. For example: `solve(15,12) = False` because `15` is not divisible by all the prime factors of `12` (which include`2`). See test cases for mor...
apps_data_3315
A strongness of an even number is the number of times we can successively divide by 2 until we reach an odd number starting with an even number n. For example, if n = 12, then * 12 / 2 = 6 * 6 / 2 = 3 So we divided successively 2 times and we reached 3, so the strongness of 12 is `2`. If n = 16 then * 16 / 2 = 8 * 8...
apps_data_3316
Inspired by the development team at Vooza, write the function `howManyLightsabersDoYouOwn`/`how_many_light_sabers_do_you_own` that * accepts the name of a programmer, and * returns the number of lightsabers owned by that person. The only person who owns lightsabers is Zach, by the way. He owns 18, which is an awesom...
apps_data_3317
**Getting Familiar:** LEET: (sometimes written as "1337" or "l33t"), also known as eleet or leetspeak, is another alphabet for the English language that is used mostly on the internet. It uses various combinations of ASCII characters to replace Latinate letters. For example, leet spellings of the word leet include 1337...
apps_data_3318
# Task Two integer numbers are added using the column addition method. When using this method, some additions of digits produce non-zero carries to the next positions. Your task is to calculate the number of non-zero carries that will occur while adding the given numbers. The numbers are added in base 10. # Example...
apps_data_3319
Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized **only** if the original word was capitalized (known as Upper Camel Case, also often referred to as Pascal case). ## Examples ```python to_camel_case("the-stealth...
apps_data_3320
###Introduction The [I Ching](https://en.wikipedia.org/wiki/I_Ching) (Yijing, or Book of Changes) is an ancient Chinese book of sixty-four hexagrams. A hexagram is a figure composed of six stacked horizontal lines, where each line is either Yang (an unbroken line) or Yin (a broken line): ``` --------- ---- ---- ...
apps_data_3321
The number n is Evil if it has an even number of 1's in its binary representation. The first few Evil numbers: 3, 5, 6, 9, 10, 12, 15, 17, 18, 20 The number n is Odious if it has an odd number of 1's in its binary representation. The first few Odious numbers: 1, 2, 4, 7, 8, 11, 13, 14, 16, 19 You have to write a functi...
apps_data_3322
# Number encrypting: cypher ## Part I of Number encrypting Katas *** ## Introduction Back then when the internet was coming up, most search functionalities simply looked for keywords in text to show relevant documents. Hackers weren't very keen on having their information displayed on websites, bulletin boards, newsgr...
apps_data_3323
# Task You are given a car odometer which displays the miles traveled as an integer. The odometer has a defect, however: it proceeds from digit `3` to digit `5` always skipping the digit `4`. This defect shows up in all positions (ones, tens, hundreds, etc). For example, if the odometer displays `15339` and th...
apps_data_3324
In JavaScript, ```if..else``` is the most basic condition statement, it consists of three parts:```condition, statement1, statement2```, like this: ```python if condition: statementa else: statementb ``` It means that if the condition is true, then execute the statementa, otherwise execute the statementb.If the...
apps_data_3325
Given a string, s, return a new string that orders the characters in order of frequency. The returned string should have the same number of characters as the original string. Make your transformation stable, meaning characters that compare equal should stay in their original order in the string s. ```python most_...
apps_data_3326
In this kata, you will be given a string of text and valid parentheses, such as `"h(el)lo"`. You must return the string, with only the text inside parentheses reversed, so `"h(el)lo"` becomes `"h(le)lo"`. However, if said parenthesized text contains parenthesized text itself, then that too must reversed back, so it fac...
apps_data_3327
You're writing an excruciatingly detailed alternate history novel set in a world where [Daniel Gabriel Fahrenheit](https://en.wikipedia.org/wiki/Daniel_Gabriel_Fahrenheit) was never born. Since Fahrenheit never lived the world kept on using the [Rømer scale](https://en.wikipedia.org/wiki/R%C3%B8mer_scale), invented by...
apps_data_3328
You have invented a time-machine which has taken you back to ancient Rome. Caeser is impressed with your programming skills and has appointed you to be the new information security officer. Caeser has ordered you to write a Caeser cipher to prevent Asterix and Obelix from reading his emails. A Caeser cipher shifts th...
apps_data_3329
### Longest Palindrome Find the length of the longest substring in the given string `s` that is the same in reverse. As an example, if the input was “I like racecars that go fast”, the substring (`racecar`) length would be `7`. If the length of the input string is `0`, the return value must be `0`. ### Ex...
apps_data_3330
>When no more interesting kata can be resolved, I just choose to create the new kata, to solve their own, to enjoy the process --myjinxin2015 said # Description: Give you two number `m` and `n`(two positive integer, m < n), make a triangle pattern with number sequence `m to n`. The order is clockwise, starting from ...
apps_data_3331
Consider an array containing cats and dogs. Each dog can catch only one cat, but cannot catch a cat that is more than `n` elements away. Your task will be to return the maximum number of cats that can be caught. For example: ```Haskell solve(['D','C','C','D','C'], 2) = 2, because the dog at index 0 (D0) catches C1 and...
apps_data_3332
Your friend won't stop texting his girlfriend. It's all he does. All day. Seriously. The texts are so mushy too! The whole situation just makes you feel ill. Being the wonderful friend that you are, you hatch an evil plot. While he's sleeping, you take his phone and change the autocorrect options so that every time ...
apps_data_3333
## Task You need to implement two functions, `xor` and `or`, that replicate the behaviour of their respective operators: - `xor` = Takes 2 values and returns `true` if, and only if, one of them is truthy. - `or` = Takes 2 values and returns `true` if either one of them is truthy. When doing so, **you cannot use the o...
apps_data_3334
Write a function which reduces fractions to their simplest form! Fractions will be presented as an array/tuple (depending on the language), and the reduced fraction must be returned as an array/tuple: ``` input: [numerator, denominator] output: [newNumerator, newDenominator] example: [45, 120] --> [3, 8] ``` All n...
apps_data_3335
ASC Week 1 Challenge 4 (Medium #1) Write a function that converts any sentence into a V A P O R W A V E sentence. a V A P O R W A V E sentence converts all the letters into uppercase, and adds 2 spaces between each letter (or special character) to create this V A P O R W A V E effect. Example...
apps_data_3336
*Debug*   function `getSumOfDigits` that takes positive integer to calculate sum of it's digits. Assume that argument is an integer. ### Example ``` 123 => 6 223 => 7 1337 => 15 ``` def get_sum_of_digits(num): return sum(map(int, str(num))) def get_sum_of_digits(num): sum = 0 str_num = str(num) for...
apps_data_3337
It's March and you just can't seem to get your mind off brackets. However, it is not due to basketball. You need to extract statements within strings that are contained within brackets. You have to write a function that returns a list of statements that are contained within brackets given a string. If the value entere...
apps_data_3338
Tranform of input array of zeros and ones to array in which counts number of continuous ones: [1, 1, 1, 0, 1] -> [3,1] from itertools import groupby def ones_counter(nums): return [sum(g) for k, g in groupby(nums) if k] import itertools as it def ones_counter(ar): return [len(list(group)) for bit, group ...
apps_data_3339
No Story No Description Only by Thinking and Testing Look at the results of the testcases, and guess the code! --- ## Series: 01. [A and B?](http://www.codewars.com/kata/56d904db9963e9cf5000037d) 02. [Incomplete string](http://www.codewars.com/kata/56d9292cc11bcc3629000533) 03. [True or False](http://www.codewars...
apps_data_3340
The [Sharkovsky's Theorem](https://en.wikipedia.org/wiki/Sharkovskii%27s_theorem) involves the following ordering of the natural numbers: ```math 3≺5≺7≺9≺ ...\\ ≺2·3≺2·5≺2·7≺2·9≺...\\ ≺2^n·3≺2^n·5≺2^n·7≺2^n·9≺...\\ ≺2^{(n+1)}·3≺2^{(n+1)}·5≺2^{(n+1)}·7≺2^{(n+1)}·9≺...\\ ≺2^n≺2^{(n-1)}≺...\\ ≺4≺2≺1\\ ``` Your task is t...
apps_data_3341
You will be given a string. You need to return an array of three strings by gradually pulling apart the string. You should repeat the following steps until the string length is 1: a) remove the final character from the original string, add to solution string 1. b) remove the first character from the original string...
apps_data_3342
## Task: You have to write a function `pattern` which returns the following Pattern(See Pattern & Examples) upto `n` number of rows. * Note:`Returning` the pattern is not the same as `Printing` the pattern. #### Rules/Note: * If `n < 1` then it should return "" i.e. empty string. * There are `no whitespaces` in the ...
apps_data_3343
**Background** You most probably know, that the *kilo* used by IT-People differs from the *kilo* used by the rest of the world. Whereas *kilo* in kB is (mostly) intrepreted as 1024 Bytes (especially by operating systems) the non-IT *kilo* denotes the factor 1000 (as in "1 kg is 1000g"). The same goes for the prefixe...
apps_data_3344
Create a function which checks a number for three different properties. - is the number prime? - is the number even? - is the number a multiple of 10? Each should return either true or false, which should be given as an array. Remark: The Haskell variant uses `data Property`. ### Examples ```python number_property(7...
apps_data_3345
There is an array of strings. All strings contains similar _letters_ except one. Try to find it! ```python find_uniq([ 'Aa', 'aaa', 'aaaaa', 'BbBb', 'Aaaa', 'AaAaAa', 'a' ]) # => 'BbBb' find_uniq([ 'abc', 'acb', 'bac', 'foo', 'bca', 'cab', 'cba' ]) # => 'foo' ``` Strings may contain spaces. Spaces is not significant,...
apps_data_3346
The prime numbers are not regularly spaced. For example from `2` to `3` the gap is `1`. From `3` to `5` the gap is `2`. From `7` to `11` it is `4`. Between 2 and 50 we have the following pairs of 2-gaps primes: `3-5, 5-7, 11-13, 17-19, 29-31, 41-43` A prime gap of length n is a run of n-1 consecutive composite numbers...
apps_data_3347
Given two integers `a` and `x`, return the minimum non-negative number to **add to** / **subtract from** `a` to make it a multiple of `x`. ```python minimum(10, 6) #= 2 10+2 = 12 which is a multiple of 6 ``` ## Note - 0 is always a multiple of `x` ## Constraints **1 <= a <= 10^(6)** **1 <= x <= 10^(5)** def min...
apps_data_3348
Your colleagues have been looking over you shoulder. When you should have been doing your boring real job, you've been using the work computers to smash in endless hours of codewars. In a team meeting, a terrible, awful person declares to the group that you aren't working. You're in trouble. You quickly have to gauge ...
apps_data_3349
You receive some random elements as a space-delimited string. Check if the elements are part of an ascending sequence of integers starting with 1, with an increment of 1 (e.g. 1, 2, 3, 4). Return: * `0` if the elements can form such a sequence, and no number is missing ("not broken", e.g. `"1 2 4 3"`) * `1` if there ...
apps_data_3350
When working with color values it can sometimes be useful to extract the individual red, green, and blue (RGB) component values for a color. Implement a function that meets these requirements: + Accepts a case-insensitive hexadecimal color string as its parameter (ex. `"#FF9933"` or `"#ff9933"`) + Returns an object wi...
apps_data_3351
# Task `EvilCode` is a game similar to `Codewars`. You have to solve programming tasks as quickly as possible. However, unlike `Codewars`, `EvilCode` awards you with a medal, depending on the time you took to solve the task. To get a medal, your time must be (strictly) inferior to the time corresponding to the medal. ...
apps_data_3352
Find the number with the most digits. If two numbers in the argument array have the same number of digits, return the first one in the array. def find_longest(xs): return max(xs, key=lambda x: len(str(x))) def find_longest(arr): return max(arr, key=lambda x: len(str(x))) def find_longest(arr): #your cod...
apps_data_3353
*** Nova polynomial subtract*** This kata is from a series on polynomial handling. ( [#1](http://www.codewars.com/kata/nova-polynomial-1-add-1) [#2](http://www.codewars.com/kata/570eb07e127ad107270005fe) [#3](http://www.codewars.com/kata/5714041e8807940ff3001140 ) [#4](http://www.codewars.com/kata/571a2e2df24bdf...
apps_data_3354
Implement a function which convert the given boolean value into its string representation. def boolean_to_string(b): return str(b) def boolean_to_string(b): return 'True' if b else 'False' boolean_to_string = str def boolean_to_string(b): if b: return "True" return "False" def boolean_t...
apps_data_3355
In this Kata, you will be given a number and your task will be to rearrange the number so that it is divisible by `25`, but without leading zeros. Return the minimum number of digit moves that are needed to make this possible. If impossible, return `-1` ( `Nothing` in Haskell ). For example: More examples in test cas...
apps_data_3356
# Kata Task Given a list of random integers, return the Three Amigos. These are 3 numbers that live next to each other in the list, and who have the **most** in common with each other by these rules: * lowest statistical range * same parity # Notes * The list will contain at least 3 numbers * If there is more than ...
apps_data_3357
You are given an array of `n+1` integers `1` through `n`. In addition there is a single duplicate integer. The array is unsorted. An example valid array would be `[3, 2, 5, 1, 3, 4]`. It has the integers `1` through `5` and `3` is duplicated. `[1, 2, 4, 5, 5]` would not be valid as it is missing `3`. You should retu...
apps_data_3358
Character recognition software is widely used to digitise printed texts. Thus the texts can be edited, searched and stored on a computer. When documents (especially pretty old ones written with a typewriter), are digitised character recognition softwares often make mistakes. Your task is correct the errors in the dig...
apps_data_3359
Write a function `titleToNumber(title) or title_to_number(title) or titleToNb title ...` (depending on the language) that given a column title as it appears in an Excel sheet, returns its corresponding column number. All column titles will be uppercase. Examples: ``` titleTonumber('A') === 1 titleTonumber('Z') ===...
apps_data_3360
## Description Peter enjoys taking risks, and this time he has decided to take it up a notch! Peter asks his local barman to pour him **n** shots, after which Peter then puts laxatives in **x** of them. He then turns around and lets the barman shuffle the shots. Peter approaches the shots and drinks **a** of them one...
apps_data_3361
~~~if:csharp,javascript,cfml,php Given a 2D array of size `m * n`. Your task is to find the sum of minimum value in each row. ~~~ ~~~if:cpp Given a 2D vector of size `m * n`. Your task is to find the sum of minimum value in each row. ~~~ ~~~if:python,ruby Given a 2D list of size `m * n`. Your task is to find the sum of...
apps_data_3362
Given an array of integers as strings and numbers, return the sum of the array values as if all were numbers. Return your answer as a number. def sum_mix(arr): return sum(map(int, arr)) def sum_mix(arr): return sum(int(n) for n in arr) def sum_mix(arr): result = 0 for a in arr: try: ...
apps_data_3363
This program tests the life of an evaporator containing a gas. We know the content of the evaporator (content in ml), the percentage of foam or gas lost every day (evap_per_day) and the threshold (threshold) in percentage beyond which the evaporator is no longer useful. All numbers are strictly positive. The program...
apps_data_3364
My grandfather always predicted how old people would get, and right before he passed away he revealed his secret! In honor of my grandfather's memory we will write a function using his formula! * Take a list of ages when each of your great-grandparent died. * Multiply each number by itself. * Add them all togethe...
apps_data_3365
You have a collection of lovely poems. Unfortuantely they aren't formatted very well. They're all on one line, like this: ``` Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. ``` What you want is to present each sentence on a new line, ...
apps_data_3366
Lexicographic permutations are ordered combinations of a set of items ordered in a specific way. For instance, the first 8 permutations of the digits 0123, in lexicographic order, are: ``` 1st 0123 2nd 0132 3rd 0213 4th 0231 5th 0312 6th 0321 7th 1023 8th 1032 ``` Your task is to write a function ```L( n, d )``` tha...
apps_data_3367
Given a side length `n`, traveling only right and down how many ways are there to get from the top left corner to the bottom right corner of an `n by n` grid? Your mission is to write a program to do just that! Add code to `route(n)` that returns the number of routes for a grid `n by n` (if n is less than 1 return 0)...
apps_data_3368
_Based on [Project Euler problem 35](https://projecteuler.net/problem=35)_ A circular prime is a prime in which every circular permutation of that number is also prime. Circular permutations are created by rotating the digits of the number, for example: `197, 971, 719`. One-digit primes are circular primes by definiti...
apps_data_3369
## Terminal game move function In this game, the hero moves from left to right. The player rolls the dice and moves the number of spaces indicated by the dice **two times**. ~~~if-not:sql Create a function for the terminal game that takes the current position of the hero and the roll (1-6) and return the new position...
apps_data_3370
In this kata the function returns an array/list of numbers without its last element. The function is already written for you and the basic tests pass, but random tests fail. Your task is to figure out why and fix it. Good luck! Hint: watch out for side effects. ~~~if:javascript Some good reading: [MDN Docs about arr...
apps_data_3371
Implement `String.eight_bit_signed_number?` (Ruby), `String.eightBitSignedNumber()` (Python), `eight_bit_signed_number()` (JS) or `StringUtils.isSignedEightBitNumber(String)` (Java) which should return `true/True` if given object is a number representable by 8 bit signed integer (-128 to -1 or 0 to 127), `false/False` ...
apps_data_3372
Given two words and a letter, return a single word that's a combination of both words, merged at the point where the given letter first appears in each word. The returned word should have the beginning of the first word and the ending of the second, with the dividing letter in the middle. You can assume both words will...
apps_data_3373
Write a function that accepts two square (`NxN`) matrices (two dimensional arrays), and returns the product of the two. Only square matrices will be given. How to multiply two square matrices: We are given two matrices, A and B, of size 2x2 (note: tests are not limited to 2x2). Matrix C, the solution, will be equal ...
apps_data_3374
You certainly can tell which is the larger number between 2^(10) and 2^(15). But what about, say, 2^(10) and 3^(10)? You know this one too. Things tend to get a bit more complicated with **both** different bases and exponents: which is larger between 3^(9) and 5^(6)? Well, by now you have surely guessed that you hav...
apps_data_3375
Consider the following numbers (where `n!` is `factorial(n)`): ``` u1 = (1 / 1!) * (1!) u2 = (1 / 2!) * (1! + 2!) u3 = (1 / 3!) * (1! + 2! + 3!) ... un = (1 / n!) * (1! + 2! + 3! + ... + n!) ``` Which will win: `1 / n!` or `(1! + 2! + 3! + ... + n!)`? Are these numbers going to `0` because of `1/n!` or to infinity du...
apps_data_3376
The squarefree part of a positive integer is the largest divisor of that integer which itself has no square factors (other than 1). For example, the squareefree part of 12 is 6, since the only larger divisor is 12, and 12 has a square factor (namely, 4). Your challenge, should you choose to accept it, is to implement ...
apps_data_3377
Given time in 24-hour format, convert it to words. ``` For example: 13:00 = one o'clock 13:09 = nine minutes past one 13:15 = quarter past one 13:29 = twenty nine minutes past one 13:30 = half past one 13:31 = twenty nine minutes to two 13:45 = quarter to two 00:48 = twelve minutes to one 00:08 = eight minutes p...
apps_data_3378
For building the encrypted string:Take every 2nd char from the string, then the other chars, that are not every 2nd char, and concat them as new String. Do this n times! Examples: ``` "This is a test!", 1 -> "hsi etTi sats!" "This is a test!", 2 -> "hsi etTi sats!" -> "s eT ashi tist!" ``` Write two methods: ```pyt...
apps_data_3379
You have been recruited by an unknown organization for your cipher encrypting/decrypting skills. Being new to the organization they decide to test your skills. Your first test is to write an algorithm that encrypts the given string in the following steps. 1. The first step of the encryption is a standard ROT13 cip...
apps_data_3380
The look and say sequence is a sequence in which each number is the result of a "look and say" operation on the previous element. Considering for example the classical version startin with `"1"`: `["1", "11", "21, "1211", "111221", ...]`. You can see that the second element describes the first as `"1(times number)1"`,...
apps_data_3381
Americans are odd people: in their buildings, the first floor is actually the ground floor and there is no 13th floor (due to superstition). Write a function that given a floor in the american system returns the floor in the european system. With the 1st floor being replaced by the ground floor and the 13th floor bei...
apps_data_3382
Your task is simply to count the total number of lowercase letters in a string. ## Examples def lowercase_count(strng): return sum(a.islower() for a in strng) import re def lowercase_count(string): return len(re.findall('[a-z]',string)) def lowercase_count(str): return sum(1 for c in str if c.islower()...
apps_data_3383
Is the number even? If the numbers is even return `true`. If it's odd, return `false`. Oh yeah... the following symbols/commands have been disabled! use of ```%``` use of ```.even?``` in Ruby use of ```mod``` in Python def is_even(n): return not n & 1 def is_even(n): return n // 2 * 2 == n def is_eve...
apps_data_3384
General primality test are often computationally expensive, so in the biggest prime number race the idea is to study special sub-families of prime number and develop more effective tests for them. [Mersenne Primes](https://en.wikipedia.org/wiki/Mersenne_prime) are prime numbers of the form: Mn = 2^(n) - 1. So far, 49...
apps_data_3385
Find the longest substring in alphabetical order. Example: the longest alphabetical substring in `"asdfaaaabbbbcttavvfffffdf"` is `"aaaabbbbctt"`. There are tests with strings up to `10 000` characters long so your code will need to be efficient. The input will only consist of lowercase characters and will be at lea...
apps_data_3386
Hi there! You have to implement the `String get_column_title(int num) // syntax depends on programming language` function that takes an integer number (index of the Excel column) and returns the string represents the title of this column. #Intro In the MS Excel lines are numbered by decimals, columns - by sets of ...
apps_data_3387
What's in a name? ..Or rather, what's a name in? For us, a particular string is where we are looking for a name. Task Test whether or not the string contains all of the letters which spell a given name, in order. The format A function passing two strings, searching for one (the name) within the other. ``function nam...
apps_data_3388
Write a function that takes in a binary string and returns the equivalent decoded text (the text is ASCII encoded). Each 8 bits on the binary string represent 1 character on the ASCII table. The input string will always be a valid binary string. Characters can be in the range from "00000000" to "11111111" (inclusive...
apps_data_3389
Write a function that when given a URL as a string, parses out just the domain name and returns it as a string. For example: ```python domain_name("http://github.com/carbonfive/raygun") == "github" domain_name("http://www.zombie-bites.com") == "zombie-bites" domain_name("https://www.cnet.com") == "cnet" ``` def domai...
apps_data_3390
A [Narcissistic Number](https://en.wikipedia.org/wiki/Narcissistic_number) is a positive number which is the sum of its own digits, each raised to the power of the number of digits in a given base. In this Kata, we will restrict ourselves to decimal (base 10). For example, take 153 (3 digits): ``` 1^3 + 5^3 + 3^3 ...
apps_data_3391
For this exercise you will create a global flatten method. The method takes in any number of arguments and flattens them into a single array. If any of the arguments passed in are an array then the individual objects within the array will be flattened so that they exist at the same level as the other arguments. Any nes...
apps_data_3392
Create a function `sierpinski` to generate an ASCII representation of a Sierpinski triangle of order **N**. Seperate each line with `\n`. You don't have to check the input value. The output should look like this: sierpinski(4) * * * ...
apps_data_3393
Divisors of 42 are : 1, 2, 3, 6, 7, 14, 21, 42. These divisors squared are: 1, 4, 9, 36, 49, 196, 441, 1764. The sum of the squared divisors is 2500 which is 50 * 50, a square! Given two integers m, n (1 <= m <= n) we want to find all integers between m and n whose sum of squared divisors is itself a square. 42 is su...
apps_data_3394
The Collatz Conjecture states that for any natural number n, if n is even, divide it by 2. If n is odd, multiply it by 3 and add 1. If you repeat the process continuously for n, n will eventually reach 1. For example, if n = 20, the resulting sequence will be: [20, 10, 5, 16, 8, 4, 2, 1] Write a program that will o...
apps_data_3395
Your task is to remove all duplicate words from a string, leaving only single (first) words entries. Example: Input: 'alpha beta beta gamma gamma gamma delta alpha beta beta gamma gamma gamma delta' Output: 'alpha beta gamma delta' def remove_duplicate_words(s): return ' '.join(dict.fromkeys(s.split())) def ...
apps_data_3396
Write a function that accepts two square matrices (`N x N` two dimensional arrays), and return the sum of the two. Both matrices being passed into the function will be of size `N x N` (square), containing only integers. How to sum two matrices: Take each cell `[n][m]` from the first matrix, and add it with the same `...
apps_data_3397
# Introduction A grille cipher was a technique for encrypting a plaintext by writing it onto a sheet of paper through a pierced sheet (of paper or cardboard or similar). The earliest known description is due to the polymath Girolamo Cardano in 1550. His proposal was for a rectangular stencil allowing single letters, ...
apps_data_3398
In this Kata, we define an arithmetic progression as a series of integers in which the differences between adjacent numbers are the same. You will be given an array of ints of `length > 2` and your task will be to convert it into an arithmetic progression by the following rule: ```Haskell For each element there are exa...
apps_data_3399
In this kata you will be given a random string of letters and tasked with returning them as a string of comma-separated sequences sorted alphabetically, with each sequence starting with an uppercase character followed by `n-1` lowercase characters, where `n` is the letter's alphabet position `1-26`. ## Example ```pyt...