id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_4000
# Definition **_Strong number_** is the number that *the sum of the factorial of its digits is equal to number itself*. ## **_For example_**: **_145_**, since ``` 1! + 4! + 5! = 1 + 24 + 120 = 145 ``` So, **_145_** is a **_Strong number_**. ____ # Task **_Given_** a number, **_Find if it is Strong or not_**. ___...
apps_data_4001
This is now a little serie :) Funny Dots You will get two Integer n (width) and m (height) and your task is to draw following pattern. Each line is seperated with '\n'. Both integers are equal or greater than 1. No need to check for invalid parameters. e.g.: +---+---+---...
apps_data_4002
Roma is programmer and he likes memes about IT, Maxim is chemist and he likes memes about chemistry, Danik is designer and he likes memes about design, and Vlad likes all other memes. ___ You will be given a meme (string), and your task is to identify its category, and send it to the right receiver: `IT - 'Roma...
apps_data_4003
# Description Write a function that accepts the current position of a knight in a chess board, it returns the possible positions that it will end up after 1 move. The resulted should be sorted. ## Example "a1" -> ["b3", "c2"] def possible_positions(p): r, c = ord(p[0])-96, int(p[1]) moves = [(-2,-1), (-2,1...
apps_data_4004
Find the first character that repeats in a String and return that character. ```python first_dup('tweet') => 't' first_dup('like') => None ``` *This is not the same as finding the character that repeats first.* *In that case, an input of 'tweet' would yield 'e'.* def first_dup(s): for x in s: if s.count...
apps_data_4005
Write a function that reverses the bits in an integer. For example, the number `417` is `110100001` in binary. Reversing the binary is `100001011` which is `267`. You can assume that the number is not negative. def reverse_bits(n): return int(bin(n)[:1:-1],2) def reverse_bits(n): return int(f'{n:b}'[::-1],2...
apps_data_4006
Your task is to create a function that does four basic mathematical operations. The function should take three arguments - operation(string/char), value1(number), value2(number). The function should return result of numbers after applying the chosen operation. ### Examples ```python basic_op('+', 4, 7) # O...
apps_data_4007
# Task Given an array `arr`, find the maximal value of `k` such `a[i] mod k` = `a[j] mod k` for all valid values of i and j. If it's impossible to find such number (there's an infinite number of `k`s), return `-1` instead. # Input/Output `[input]` integer array `arr` A non-empty array of positive integer. `2 <= a...
apps_data_4008
Given a string containing a list of integers separated by commas, write the function string_to_int_list(s) that takes said string and returns a new list containing all integers present in the string, preserving the order. For example, give the string "-1,2,3,4,5", the function string_to_int_list() should return [-1,2,...
apps_data_4009
Given an integer, take the (mean) average of each pair of consecutive digits. Repeat this process until you have a single integer, then return that integer. e.g. Note: if the average of two digits is not an integer, round the result **up** (e.g. the average of 8 and 9 will be 9) ## Examples ``` digitsAverage(246) =...
apps_data_4010
# Task Given some sticks by an array `V` of positive integers, where V[i] represents the length of the sticks, find the number of ways we can choose three of them to form a triangle. # Example For `V = [2, 3, 7, 4]`, the result should be `1`. There is only `(2, 3, 4)` can form a triangle. For `V = [5, 6, 7, 8]`...
apps_data_4011
# How many urinals are free? In men's public toilets with urinals, there is this unwritten rule that you leave at least one urinal free between you and the next person peeing. For example if there are 3 urinals and one person is already peeing in the left one, you will choose the urinal on the right and not the one in...
apps_data_4012
### Background In classical cryptography, the Hill cipher is a polygraphic substitution cipher based on linear algebra. It was invented by Lester S. Hill in 1929. ### Task This cipher involves a text key which has to be turned into a matrix and text which needs to be encoded. The text key can be of any perfect squ...
apps_data_4013
A spoonerism is a spoken phrase in which the first letters of two of the words are swapped around, often with amusing results. In its most basic form a spoonerism is a two word phrase in which only the first letters of each word are swapped: ```"not picking" --> "pot nicking"``` Your task is to create a function tha...
apps_data_4014
Write a function that takes an arbitrary number of strings and interlaces them (combines them by alternating characters from each string). For example `combineStrings('abc', '123')` should return `'a1b2c3'`. If the strings are different lengths the function should interlace them until each string runs out, continuing...
apps_data_4015
# Story You and a group of friends are earning some extra money in the school holidays by re-painting the numbers on people's letterboxes for a small fee. Since there are 10 of you in the group each person just concentrates on painting one digit! For example, somebody will paint only the ```1```'s, somebody else will...
apps_data_4016
Mike and Joe are fratboys that love beer and games that involve drinking. They play the following game: Mike chugs one beer, then Joe chugs 2 beers, then Mike chugs 3 beers, then Joe chugs 4 beers, and so on. Once someone can't drink what he is supposed to drink, he loses. Mike can chug at most A beers in total (other...
apps_data_4017
Make multiple functions that will return the sum, difference, modulus, product, quotient, and the exponent respectively. Please use the following function names: addition = **add** multiply = **multiply** division = **divide** (both integer and float divisions are accepted) modulus = **mod** exponential = **expo...
apps_data_4018
Given a string s, write a method (function) that will return true if its a valid single integer or floating number or false if its not. Valid examples, should return true: should return false: def isDigit(string): try: float(string) return True except: return False def isDigit(strng)...
apps_data_4019
# Task **_Given_** a **_Divisor and a Bound_** , *Find the largest integer N* , Such That , # Conditions : * **_N_** is *divisible by divisor* * **_N_** is *less than or equal to bound* * **_N_** is *greater than 0*. ___ # Notes * The **_parameters (divisor, bound)_** passed to the function are *only posit...
apps_data_4020
You received a whatsup message from an unknown number. Could it be from that girl/boy with a foreign accent you met yesterday evening? Write a simple regex to check if the string contains the word hallo in different languages. These are the languages of the possible people you met the night before: * hello - english...
apps_data_4021
# Task Elections are in progress! Given an array of numbers representing votes given to each of the candidates, and an integer which is equal to the number of voters who haven't cast their vote yet, find the number of candidates who still have a chance to win the election. The winner of the election must secure stri...
apps_data_4022
# A History Lesson Soundex is an interesting phonetic algorithm developed nearly 100 years ago for indexing names as they are pronounced in English. The goal is for homophones to be encoded to the same representation so that they can be matched despite minor differences in spelling. Reference: https://en.wikipedia.or...
apps_data_4023
Given a string of words, you need to find the highest scoring word. Each letter of a word scores points according to its position in the alphabet: `a = 1, b = 2, c = 3` etc. You need to return the highest scoring word as a string. If two words score the same, return the word that appears earliest in the original str...
apps_data_4024
# Definition A number is a **_Special Number_** *if it’s digits only consist 0, 1, 2, 3, 4 or 5* **_Given_** a number *determine if it special number or not* . # Warm-up (Highly recommended) # [Playing With Numbers Series](https://www.codewars.com/collections/playing-with-numbers) ___ # Notes * **_The numbe...
apps_data_4025
In this kata, you have to define a function named **func** that will take a list as input. You must try and guess the pattern how we get the output number and return list - **[output number,binary representation,octal representation,hexadecimal representation]**, but **you must convert that specific number without bui...
apps_data_4026
### Preface You are currently working together with a local community to build a school teaching children how to code. First plans have been made and the community wants to decide on the best location for the coding school. In order to make this decision data about the location of students and potential locations is co...
apps_data_4027
Build a function `sumNestedNumbers`/`sum_nested_numbers` that finds the sum of all numbers in a series of nested arrays raised to the power of their respective nesting levels. Numbers in the outer most array should be raised to the power of 1. For example, should return `1 + 2*2 + 3 + 4*4 + 5*5*5 === 149` def sum_n...
apps_data_4028
# A History Lesson The Pony Express was a mail service operating in the US in 1859-60. It reduced the time for messages to travel between the Atlantic and Pacific coasts to about 10 days, before it was made obsolete by the transcontinental telegraph. # How it worked There were a number of *stations*, where: *...
apps_data_4029
Complete the solution so that it returns the number of times the search_text is found within the full_text. ```python search_substr( fullText, searchText, allowOverlap = true ) ``` so that overlapping solutions are (not) counted. If the searchText is empty, it should return `0`. Usage examples: ```python search_subs...
apps_data_4030
Implement a function which creates a **[radix tree](https://en.wikipedia.org/wiki/Radix_tree)** (a space-optimized trie [prefix tree]) in which each node that is the only child is merged with its parent [unless a word from the input ends there]) from a given list of words using dictionaries (aka hash maps or hash t...
apps_data_4031
# Esolang Interpreters #2 - Custom Smallfuck Interpreter ## About this Kata Series "Esolang Interpreters" is a Kata Series that originally began as three separate, independent esolang interpreter Kata authored by [@donaldsebleung](http://codewars.com/users/donaldsebleung) which all shared a similar format and were al...
apps_data_4032
Consider the number triangle below, in which each number is equal to the number above plus the number to the left. If there is no number above, assume it's a `0`. The triangle has `5` rows and the sum of the last row is `sum([1,4,9,14,14]) = 42`. You will be given an integer `n` and your task will be to return the su...
apps_data_4033
An AI has infected a text with a character!! This text is now **fully mutated** to this character. If the text or the character are empty, return an empty string. There will never be a case when both are empty as nothing is going on!! **Note:** The character is a string of length 1 or an empty string. # Example ...
apps_data_4034
Create a function that takes a string and returns that string with the first half lowercased and the last half uppercased. eg: foobar == fooBAR If it is an odd number then 'round' it up to find which letters to uppercase. See example below. sillycase("brian") // --^-- midpoint // bri ...
apps_data_4035
Given 2 strings, your job is to find out if there is a substring that appears in both strings. You will return true if you find a substring that appears in both strings, or false if you do not. We only care about substrings that are longer than one letter long. #Examples: ```` *Example 1* SubstringTest("Something","F...
apps_data_4036
How many days are we represented in a foreign country? My colleagues make business trips to a foreign country. We must find the number of days our company is represented in a country. Every day that one or more colleagues are present in the country is a day that the company is represented. A single day cannot count fo...
apps_data_4037
When a warrior wants to talk with another one about peace or war he uses a smartphone. In one distinct country warriors who spent all time in training kata not always have enough money. So if they call some number they want to know which operator serves this number. Write a function which **accepts number and retu...
apps_data_4038
# Task Given a position of a knight on the standard chessboard, find the number of different moves the knight can perform. The knight can move to a square that is two squares horizontally and one square vertically, or two squares vertically and one square horizontally away from it. The complete move therefore looks ...
apps_data_4039
# Fourier transformations are hard. Fouriest transformations are harder. This Kata is based on the SMBC Comic on fourier transformations. A fourier transformation on a number is one that converts the number to a base in which it has more `4`s ( `10` in base `6` is `14`, which has `1` four as opposed to none, hence, f...
apps_data_4040
Complete the function that takes an array of words. You must concatenate the `n`th letter from each word to construct a new word which should be returned as a string, where `n` is the position of the word in the list. For example: ``` ["yoda", "best", "has"] --> "yes" ^ ^ ^ n=0 n=1 n=2 ``...
apps_data_4041
Given a string S. You have to return another string such that even-indexed and odd-indexed characters of S are grouped and groups are space-separated (see sample below) Note: 0 is considered to be an even index. All input strings are valid with no spaces input: 'CodeWars' output 'CdWr oeas' S[0] = 'C' S[1] = 'o'...
apps_data_4042
You have the `radius` of a circle with the center in point `(0,0)`. Write a function that calculates the number of points in the circle where `(x,y)` - the cartesian coordinates of the points - are `integers`. Example: for `radius = 2` the result should be `13`. `0 <= radius <= 1000` ![](http://i.imgur.com/1SMov3s....
apps_data_4043
# Task John won the championship of a TV show. He can get some bonuses. He needs to play a game to determine the amount of his bonus. Here are `n` rows and `m` columns of cards were placed on the ground. A non-negative number is written on each card. The rules of the game are: - Player starts from the top-left con...
apps_data_4044
Let's say take 2 strings, A and B, and define the similarity of the strings to be the length of the longest prefix common to both strings. For example, the similarity of strings `abc` and `abd` is 2, while the similarity of strings `aaa` and `aaab` is 3. write a function that calculates the sum of similarities of a st...
apps_data_4045
Your team is writing a fancy new text editor and you've been tasked with implementing the line numbering. Write a function which takes a list of strings and returns each line prepended by the correct number. The numbering starts at 1. The format is `n: string`. Notice the colon and space in between. **Examples:** `...
apps_data_4046
# Explanation It's your first day in the robot factory and your supervisor thinks that you should start with an easy task. So you are responsible for purchasing raw materials needed to produce the robots. A complete robot weights `50` kilogram. Iron is the only material needed to create a robot. All iron is inserted ...
apps_data_4047
```if-not:rust Your task is to write a function `toLeetSpeak` that converts a regular english sentence to Leetspeak. ``` ```if:rust Your task is to write a function `to_leet_speak` that converts a regular english sentence to Leetspeak. ``` More about LeetSpeak You can read at wiki -> https://en.wikipedia.org/wiki/Leet...
apps_data_4048
Task: Make a function that converts a word to pig latin. The rules of pig latin are: ``` If the word has more than 3 letters: 1. Take the first letter of a word and move it to the end 2. Add -ay to the word Otherwise leave the word alone. ``` Example: `hello` = `ellohay` def pig_latin(word): return word[1:]+...
apps_data_4049
You take your son to the forest to see the monkeys. You know that there are a certain number there (n), but your son is too young to just appreciate the full number, he has to start counting them from 1. As a good parent, you will sit and count with him. Given the number (n), populate an array with all numbers up to a...
apps_data_4050
Laura really hates people using acronyms in her office and wants to force her colleagues to remove all acronyms before emailing her. She wants you to build a system that will edit out all known acronyms or else will notify the sender if unknown acronyms are present. Any combination of three or more letters in upper ca...
apps_data_4051
You wrote all your unit test names in camelCase. But some of your colleagues have troubles reading these long test names. So you make a compromise to switch to underscore separation. To make these changes fast you wrote a class to translate a camelCase name into an underscore separated name. Implement the ToUnderscor...
apps_data_4052
You will be given the prime factors of a number as an array. E.g: ```[2,2,2,3,3,5,5,13]``` You need to find the number, n, to which that prime factorization belongs. It will be: ``` n = 2³.3².5².13 = 23400 ``` Then, generate the divisors of this number. Your function ```get_num() or getNum()``` will receive an array ...
apps_data_4053
I'm sure you're familiar with factorials – that is, the product of an integer and all the integers below it. For example, `5! = 120`, as `5 * 4 * 3 * 2 * 1 = 120` Your challenge is to create a function that takes any number and returns the number that it is a factorial of. So, if your function receives `120`, it sho...
apps_data_4054
**This Kata is intended as a small challenge for my students** All Star Code Challenge #23 There is a certain multiplayer game where players are assessed at the end of the game for merit. Players are ranked according to an internal scoring system that players don't see. You've discovered the formula for the scoring ...
apps_data_4055
Given that ``` f0 = '0' f1 = '01' f2 = '010' = f1 + f0 f3 = '01001' = f2 + f1 ``` You will be given a number and your task is to return the `nth` fibonacci string. For example: ``` solve(2) = '010' solve(3) = '01001' ``` More examples in test cases. Good luck! If you like sequence Katas, you will enjoy this Kata: ...
apps_data_4056
# Leaderboard climbers In this kata you will be given a leaderboard of unique names for example: ```python ['John', 'Brian', 'Jim', 'Dave', 'Fred'] ``` Then you will be given a list of strings for example: ```python ['Dave +1', 'Fred +4', 'Brian -1'] ``` Then you sort the leaderboard. The steps for our exampl...
apps_data_4057
Complete the function that determines the score of a hand in the card game [Blackjack](https://en.wikipedia.org/wiki/Blackjack) (aka 21). The function receives an array of strings that represent each card in the hand (`"2"`, `"3",` ..., `"10"`, `"J"`, `"Q"`, `"K"` or `"A"`) and should return the score of the hand (int...
apps_data_4058
### Task: You have to write a function `pattern` which returns the following Pattern(See Examples) upto (2n-1) rows, where n is parameter. * Note:`Returning` the pattern is not the same as `Printing` the pattern. #### Parameters: pattern( n ); ^ ...
apps_data_4059
# Task `N` candles are placed in a row, some of them are initially lit. For each candle from the 1st to the Nth the following algorithm is applied: if the observed candle is lit then states of this candle and all candles before it are changed to the opposite. Which candles will remain lit after applying the algorithm ...
apps_data_4060
# Background My pet bridge-maker ants are marching across a terrain from left to right. If they encounter a gap, the first one stops and then next one climbs over him, then the next, and the next, until a bridge is formed across the gap. What clever little things they are! Now all the other ants can walk over the ...
apps_data_4061
Consider the sequence `a(1) = 7, a(n) = a(n-1) + gcd(n, a(n-1)) for n >= 2`: `7, 8, 9, 10, 15, 18, 19, 20, 21, 22, 33, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 69, 72, 73...`. Let us take the differences between successive elements of the sequence and get a second sequence `g: 1, 1, 1, 5, 3, 1, 1, 1, 1, 11, 3, 1,...
apps_data_4062
An element in an array is dominant if it is greater than all elements to its right. You will be given an array and your task will be to return a list of all dominant elements. For example: ```Haskell solve([1,21,4,7,5]) = [21,7,5] because 21, 7 and 5 are greater than elments to their right. solve([5,4,3,2,1]) = [5,4,3...
apps_data_4063
Mr. E Ven only likes even length words. Please create a translator so that he doesn't have to hear those pesky odd length words. For some reason he also hates punctuation, he likes his sentences to flow. Your translator should take in a string and output it with all odd length words having an extra letter (the last le...
apps_data_4064
Create a function with two arguments that will return an array of the first (n) multiples of (x). Assume both the given number and the number of times to count will be positive numbers greater than 0. Return the results as an array (or list in Python, Haskell or Elixir). Examples: ```python count_by(1,10) #should...
apps_data_4065
In mathematics, a **pandigital number** is a number that in a given base has among its significant digits each digit used in the base at least once. For example, 1234567890 is a pandigital number in base 10. For simplification, in this kata, we will consider pandigital numbers in *base 10* and with all digits used *ex...
apps_data_4066
Write a function to split a string and convert it into an array of words. For example: ```python "Robin Singh" ==> ["Robin", "Singh"] "I love arrays they are my favorite" ==> ["I", "love", "arrays", "they", "are", "my", "favorite"] ``` def string_to_array(string): return string.split(" ") def string_to_array(st...
apps_data_4067
Bob is preparing to pass IQ test. The most frequent task in this test is `to find out which one of the given numbers differs from the others`. Bob observed that one number usually differs from the others in **evenness**. Help Bob — to check his answers, he needs a program that among the given numbers finds one that is ...
apps_data_4068
# Task Mr.Nam has `n` candies, he wants to put one candy in each cell of a table-box. The table-box has `r` rows and `c` columns. Each candy was labeled by its cell number. The cell numbers are in range from 1 to N and the direction begins from right to left and from bottom to top. Nam wants to know the position o...
apps_data_4069
I love Fibonacci numbers in general, but I must admit I love some more than others. I would like for you to write me a function that when given a number (n) returns the n-th number in the Fibonacci Sequence. For example: ```python nth_fib(4) == 2 ``` Because 2 is the 4th number in the Fibonacci Sequence. For ...
apps_data_4070
The magic sum of 3s is calculated on an array by summing up odd numbers which include the digit `3`. Write a function `magic_sum` which accepts an array of integers and returns the sum. *Example:* `[3, 12, 5, 8, 30, 13]` results in `16` (`3` + `13`) If the sum cannot be calculated, `0` should be returned. def magic_...
apps_data_4071
# Scenario *You're saying good-bye your best friend* , **_See you next happy year_** . **_Happy Year_** *is the year with only distinct digits* , (e.g) **_2018_** ___ # Task **_Given_** a year, **_Find_** **_The next happy year_** or **_The closest year You'll see your best friend_** ![!alt](https://i.imgur....
apps_data_4072
#Permutation position In this kata you will have to permutate through a string of lowercase letters, each permutation will start at ```a``` and you must calculate how many iterations it takes to reach the current permutation. ##examples ``` input: 'a' result: 1 input: 'c' result: 3 input: 'z' result: 26 input: 'fo...
apps_data_4073
# Task Given a rectangular `matrix` and integers `a` and `b`, consider the union of the ath row and the bth (both 0-based) column of the `matrix`. Return sum of all elements of that union. # Example For ``` matrix = [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]] a = 1 and b = 3 ``` the output shou...
apps_data_4074
Given an array of numbers, return the difference between the largest and smallest values. For example: `[23, 3, 19, 21, 16]` should return `20` (i.e., `23 - 3`). `[1, 434, 555, 34, 112]` should return `554` (i.e., `555 - 1`). The array will contain a minimum of two elements. Input data range guarantees that `max-m...
apps_data_4075
We have the following recursive function: The 15-th term; ```f(14)``` is the first term in having more that 100 digits. In fact, ``` f(14) = 2596253046576879973769082409566059879570061514363339324718953988724415850732046186170181072783243503881471037546575506836249417271830960970629933033088 It has 151 digits. ``...
apps_data_4076
Error Handling is very important in coding and seems to be overlooked or not implemented properly. #Task Your task is to implement a function which takes a string as input and return an object containing the properties vowels and consonants. The vowels property must contain the total count of vowels {a,e,i,o,u}, and ...
apps_data_4077
The new football league season is coming and the Football Association need some help resetting the league standings. Normally the initial league standing is done in alphabetical order (from A to Z) but this year the FA have decided to freshen it up. It has been decided that team who finished first last season will be...
apps_data_4078
Your task is to write a function that does just what the title suggests (so, fair warning, be aware that you are not getting out of it just throwing a lame bas sorting method there) with an array/list/vector of integers and the expected number `n` of smallest elements to return. Also: * the number of elements to be r...
apps_data_4079
This is a follow up from my kata The old switcheroo Write ```python def encode(str) ``` that takes in a string ```str``` and replaces all the letters with their respective positions in the English alphabet. ```python encode('abc') == '123' # a is 1st in English alpabet, b is 2nd and c is 3rd encode('codewars') == '...
apps_data_4080
Is every value in the array an array? This should only test the second array dimension of the array. The values of the nested arrays don't have to be arrays. Examples: ```python [[1],[2]] => true ['1','2'] => false [{1:1},{2:2}] => false ``` def arr_check(arr): return all(isinstance(el, list) for el in arr) d...
apps_data_4081
Baby is getting his frst tooth. This means more sleepless nights, but with the fun of feeling round his gums and trying to guess which will be first out! Probably best have a sweepstake with your friends - because you have the best chance of knowing. You can feel the gums and see where the raised bits are - most rais...
apps_data_4082
A series or sequence of numbers is usually the product of a function and can either be infinite or finite. In this kata we will only consider finite series and you are required to return a code according to the type of sequence: |Code|Type|Example| |-|-|-| |`0`|`unordered`|`[3,5,8,1,14,3]`| |`1`|`strictly increasing`...
apps_data_4083
This challenge is based on [the kata](https://www.codewars.com/kata/n-smallest-elements-in-original-order) by GiacomoSorbi. Before doing this one it is advisable to complete the non-performance version first. ___ # Task You will be given an array of random integers and a number `n`. You have to extract `n` smallest ...
apps_data_4084
Alex is transitioning from website design to coding and wants to sharpen his skills with CodeWars. He can do ten kata in an hour, but when he makes a mistake, he must do pushups. These pushups really tire poor Alex out, so every time he does them they take twice as long. His first set of redemption pushups takes 5 mi...
apps_data_4085
One of the first chain emails I ever received was about a supposed Cambridge University study that suggests your brain can read words no matter what order the letters are in, as long as the first and last letters of each word are correct. Your task is to **create a function that can take any string and randomly jumbl...
apps_data_4086
Your task is to find the first element of an array that is not consecutive. By not consecutive we mean not exactly 1 larger than the previous element of the array. E.g. If we have an array `[1,2,3,4,6,7,8]` then `1` then `2` then `3` then `4` are all consecutive but `6` is not, so that's the first non-consecutive num...
apps_data_4087
Write a function which takes a number and returns the corresponding ASCII char for that value. Example: ~~~if-not:java,racket ``` get_char(65) # => 'A' ``` ~~~ ~~~if:java ~~~ ~~~if:racket ~~~ For ASCII table, you can refer to http://www.asciitable.com/ def get_char(c): return chr(c) get_char=chr def get_char...
apps_data_4088
# Fun fact Tetris was the first video game played in outer space In 1993, Russian cosmonaut Aleksandr A. Serebrov spent 196 days on the Mir space station with a very special distraction: a gray Game Boy loaded with Tetris. During that time the game orbited the Earth 3,000 times and became the first video game played i...
apps_data_4089
The number 45 is the first integer in having this interesting property: the sum of the number with its reversed is divisible by the difference between them(absolute Value). ``` 45 + 54 = 99 abs(45 - 54) = 9 99 is divisible by 9. ``` The first terms of this special sequence are : ``` n a(n) 1 ...
apps_data_4090
Farmer Bob have a big farm, where he growths chickens, rabbits and cows. It is very difficult to count the number of animals for each type manually, so he diceded to buy a system to do it. But he bought a cheap system that can count only total number of heads, total number of legs and total number of horns of animals o...
apps_data_4091
You're continuing to enjoy your new piano, as described in Piano Kata, Part 1. You're also continuing the exercise where you start on the very first (leftmost, lowest in pitch) key on the 88-key keyboard, which (as shown below) is the note A, with the little finger on your left hand, then the second key, which is the b...
apps_data_4092
# Grasshopper - Function syntax debugging A student was working on a function and made some syntax mistakes while coding. Help them find their mistakes and fix them. def main(verb, noun): return verb + noun def main (verb, noun): # This function has three problems: square brackets instead of parenthesis, ...
apps_data_4093
In an infinite array with two rows, the numbers in the top row are denoted `. . . , A[−2], A[−1], A[0], A[1], A[2], . . .` and the numbers in the bottom row are denoted `. . . , B[−2], B[−1], B[0], B[1], B[2], . . .` For each integer `k`, the entry `A[k]` is directly above the entry `B[k]` in the array, as shown: ...
apps_data_4094
Given an array of integers. Return an array, where the first element is the count of positives numbers and the second element is sum of negative numbers. If the input array is empty or null, return an empty array. # Example For input `[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15]`, you should return `[10...
apps_data_4095
Given two strings, the first being a random string and the second being the same as the first, but with three added characters somewhere in the string (three same characters), Write a function that returns the added character ### E.g ``` string1 = "hello" string2 = "aaahello" // => 'a' ``` The above is just an exa...
apps_data_4096
Write a function called that takes a string of parentheses, and determines if the order of the parentheses is valid. The function should return `true` if the string is valid, and `false` if it's invalid. ## Examples ``` "()" => true ")(()))" => false "(" => false "(())((()())())...
apps_data_4097
Hi guys, welcome to introduction to DocTesting. The kata is composed of two parts; in part (1) we write three small functions, and in part (2) we write a few doc tests for those functions. Lets talk about the functions first... The reverse_list function takes a list and returns the reverse of it. If given an...
apps_data_4098
# Task Your Informatics teacher at school likes coming up with new ways to help you understand the material. When you started studying numeral systems, he introduced his own numeral system, which he's convinced will help clarify things. His numeral system has base 26, and its digits are represented by English capital ...
apps_data_4099
Your work is to write a method that takes a value and an index, and returns the value with the bit at given index flipped. The bits are numbered from the least significant bit (index 1). Example: ```python flip_bit(15, 4) == 7 # 15 in binary is 1111, after flipping 4th bit, it becomes 0111, i.e. 7 flip_bit(15, 5) == ...