Search
• ###### Filter by Language:
• Kumite (ko͞omiˌtā) is the practice of taking techniques learned from Kata and applying them through the act of freestyle sparring.

You can create a new kumite by providing some initial code and optionally some test cases. From there other warriors can spar with you, by enhancing, refactoring and translating your code. There is no limit to how many warriors you can spar with.

A great use for kumite is to begin an idea for a kata as one. You can collaborate with other code warriors until you have it right, then you can convert it to a kata.

### Divide by 3 without division operation

Code
Diff
• ``````function dividedByThree(int \$number): bool
{
while ((\$number = abs(\$number)) > 10) {
\$number = array_sum(str_split(\$number));
}

return in_array(\$number, [3,6,9]);
}
``````
•  1 1 function dividedByThree(int \$number): bool 2 2 { 3 - \$abs = abs(\$number); 4 - if(\$abs < 10){ 5 - return \$abs == 3 || \$abs == 6 || \$abs == 9; 3 + while ((\$number = abs(\$number)) > 10) { 4 + \$number = array_sum(str_split(\$number)); 6 6 } 7 - \$sum = array_sum(str_split(\$abs,1)); 8 - return dividedByThree(\$sum); 6 + 7 + return in_array(\$number, [3,6,9]); 9 9 }

### Hailstone numbers

Hailstone numbers are an interesting number series. The series is defined as follows:

• Pick a number
• If odd multiply by 3 add one
• Else even divide by 2
• Stop calculating the sequence when you reach 1

Different numbers reach one after a different number of steps.

e.g. Here are a few Hailstones that take a long time to reach 1

Hailstone 27 Steps: 112
Hailstone 54 Steps: 113
Hailstone 73 Steps: 116

Your code will need to be efficient with BigInt Lists

``````case class Hailstones (hailstoneStart : BigInt ) {
private def getSequenceHighPerformance (currentHailstone : BigInt,  acc : List[BigInt]) : List[BigInt] = {
if (currentHailstone == 1) currentHailstone::acc
else if (currentHailstone.testBit(0)) getSequenceHighPerformance((currentHailstone << 1) + currentHailstone + 1, currentHailstone :: acc)
else getSequenceHighPerformance(currentHailstone >> 1, currentHailstone :: acc)
}

val seq = getSequenceHighPerformance(hailstoneStart, List[BigInt]()).reverse
}

object Hailstones {
def findSeq = Hailstones(18).seq
}``````

### lolololol

shortest I can get it

Code
Diff
• ``tickets=lambda a:"YNEOS"[100in a::2]``
•  1 - def tickets(l): 2 - return "YES" if len(l) == 3 else "NO" 1 + tickets=lambda a:"YNEOS"[100in a::2]

### Convert to Base 2

Write a function that converts a base 10 number and returns binary (base 2).

Binary is consisted of zeros and ones only, and those make up the binary number.

Suppose that place value works the same.

``````func binaryConverter(_ input: Int) -> Int {
return input
}``````

### Series of Calculators - Easy

Make a calculator that can take in two integers and process any of the four basic operations. (Add, subtract, multiply, divide).

For the operation symbol, you need to turn the string that the person has inserted, and it should not be case sensitive.

Finally, it should return "Not a valid operation", if the operation that the user entered is not one of the four.

``````func calculator(_ int1: Int, _ operation: String, _ int2: Int) {
//Code Here
}``````

Here are the criteria: used in assessing:

90-100 points = A

80-89 points = B

70-79 points = C

60-69 points = D

0-59 points = F

Make sure to return "Not a grade" for integers that are not equal to or between 100.

``````func gradeCalc(_ score: Int) {
}``````
Failed Tests

### criticus

``#testing kumite``

### find highest and lowest number in a string array

Code
Diff
• ``````def high_and_low(str_in)
str_in.split.minmax_by{|n|-n.to_i}.join(' ')
end``````
•  1 1 def high_and_low(str_in) 2 - str_in.split.map(&:to_i).minmax.reverse.join(' ') 2 + str_in.split.minmax_by{|n|-n.to_i}.join(' ') 3 3 end

### Return Hello World

Code
Diff
• ``````#define _GNU_SOURCE 1
#include <string.h>

char *Hi(void) {
char *x = strdup("Hello World.");
return x;
}``````
•  1 + #define _GNU_SOURCE 1 1 1 #include 2 - #include 3 - #define x "Hello World." 4 4 5 5 char *Hi(void) { 6 - char *ans = calloc(strlen(x) + 1, sizeof(char)); 7 - strcpy(ans, x); 8 - return ans; 5 + char *x = strdup("Hello World."); 6 + return x; 9 9 }