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.

```
console.log('flat' in Array.prototype);
console.log([].flat());
```

Merge sort uses Divide and Conquer to split inputs and merge the halfs so they are sorted.

Given some numbers sort via merge sort:

```
[1,3,2]
[1] , [3, 2]
[1] , [3] , [2]
[1,2], [3]
[1,2,3]
```

Can someone help me with adding in the GinkGo Tests?

```
package main
import "fmt"
func merge_sort(slice []int) []int {
length := len(slice)
if length < 2 {
return slice
}
mid := (length) / 2
return merge(merge_sort(slice[:mid]), merge_sort(slice[mid:]))
}
func merge(left, right []int) []int {
size, l, r := len(left)+len(right), 0, 0
slice := make([]int, size, size)
for i := 0; i < size; i++ {
if l > len(left)-1 && r <= len(right)-1 {
slice[i] = right[r]
r++
} else if r > len(right)-1 && l <= len(left)-1 {
slice[i] = left[l]
l++
} else if left[l] < right[r] {
slice[i] = left[l]
l++
} else {
slice[i] = right[r]
r++
}
}
return slice
}
func main() {
arr := []int{3, 4, 1, 2, 5}
fmt.Print(merge_sort(arr))
}
```

Can anyone help with this? The code is supposed to take a string such as "it is nine 'oclock" and output the numerical position of each letter(letters only). my ouput seems to match both examples given exactly, but still says incorrect. any suggestions would be appreciated.

```
import string
def alphabet_position(text):
aaa = ""
for i in text:
if i.isalpha() == True:
i = i.lower()
aaa = aaa + str(string.ascii_lowercase.index(i) + 1 )
aaa = aaa + " "
else:
pass
print(aaa)
```

```
# TODO: Replace examples and use TDD by writing your own tests
# These are some of the methods available:
# test.expect(boolean, [optional] message)
# test.assert_equals(actual, expected, [optional] message)
# test.assert_not_equals(actual, expected, [optional] message)
# You can use Test.describe and Test.it to write BDD style test groupings
```

```
def square(ty):
a = a * a
return b
```

`Test.it("something")`

Given an array of 'n' elements

You have to return an array of arrays that contain all possible combinations of the elements of the provided array

e.g. if given array is

L=[1,2]

you have to return an array containing [],[1],[2],[1,2]

i.e. [[],[1],[2],[1,2]]

check that the array you return is having elements in the ascending fashion of their lengths

i.e. if L=[1,2,3]

your program should return [[],[1],[2].[3],[1,2],[1,3],[2,3],[1,2,3]]

```
def powerset(L):
pset=[[]] #empty list and original list are always part
#of powerset
if L not in pset:
pset.append(L)
P=[]
for i in subset(L): #Calling subset(L) for adding subsets to pset
if i not in pset:
pset.append(i)
#building a List that has same elements as of pset but in right order
for z in range(len(L)+1):
for y in pset[::-1]: #iterating over pset in reverse order
if len(y)==z: #adding elements in ascending order of their lengths
P.append(y)
return P
def subset(L):
"""
Takes a list L and returns a list of all possible subsets of L
"""
List=L[:] #Copy of L
S=[] #List of subsets of L
i=0
while i<len(L):
#in each iteration removing ith element of List to get a subset
List.remove(List[i])
if List not in S: #avoiding copies
S.append(List[:])
#getting further subsets of mutated List
#but only if len(List)>2
if len(L)>2:
X=subset(List) #Recursive call
for x in X: #Extracting elements of returned S
if x not in S: #as S is a list of lists
S.append(x)
List=L[:] #Restoring List after several mutations
#so that next time mutated list is not
#encountered in line 16
i+=1
return S #list of subsets
```

```
Test.describe('Basic Tests')
Test.it('should handle simple tests')
Test.assert_equals(powerset([]), [[]])
Test.assert_equals(powerset([1]), [[],[1]])
Test.it("should handle list with 2 or more elements")
Test.assert_equals(powerset([1,10]), [[],[1],[10],[1,10]])
Test.assert_equals(powerset([64,65,117,22]), [[], [64], [65], [117], [22], [64, 65], [64, 117], [64, 22], [65, 117], [65, 22], [117, 22], [64, 65, 117], [64, 65, 22], [64, 117, 22], [65, 117, 22], [64, 65, 117, 22]])
Test.it("should handle list with mixed enteries")
Test.assert_equals(powerset(['a','b','c']), [[], ['a'], ['b'], ['c'], ['a', 'b'], ['a', 'c'], ['b', 'c'], ['a', 'b', 'c']])
Test.assert_equals(powerset(['@',2,[2,3]]),[[], ['@'], [2], [[2, 3]], ['@', 2], ['@', [2, 3]], [2, [2, 3]], ['@', 2, [2, 3]]])
```

Write a function that receives three random integers and assigns their sorted values to an array pointer. Integers should be sorted without using any predefined or external functions.

```
void sort_three(int a, int b, int c, int *sorted)
{
if(a > b) { int t=a; a=b; b=t; }
if(b > c) { int t=b; b=c; c=t; }
if(a > b) { int t=a; a=b; b=t; }
sorted[0] = a;
sorted[1] = b;
sorted[2] = c;
}
```

```
#include <criterion/criterion.h>
#include <time.h>
void tester(int a, int b, int c, int exp[3]);
Test(The_Basic_Tests, gotta_pass_em) {
{
int a = 1, b = 2, c = 3;
int expected[3] = {1, 2, 3};
tester(a, b, c, expected);
}
{
int a = 1, b = 3, c = 2;
int expected[3] = {1, 2, 3};
tester(a, b, c, expected);
}
{
int a = 2, b = 1, c = 3;
int expected[3] = {1, 2, 3};
tester(a, b, c, expected);
}
{
int a = 2, b = 3, c = 1;
int expected[3] = {1, 2, 3};
tester(a, b, c, expected);
}
{
int a = 3, b = 1, c = 2;
int expected[3] = {1, 2, 3};
tester(a, b, c, expected);
}
{
int a = 3, b = 2, c = 1;
int expected[3] = {1, 2, 3};
tester(a, b, c, expected);
}
{
int a = 1, b = 1, c = 2;
int expected[3] = {1, 1, 2};
tester(a, b, c, expected);
}
{
int a = 1, b = 2, c = 1;
int expected[3] = {1, 1, 2};
tester(a, b, c, expected);
}
{
int a = 2, b = 1, c = 1;
int expected[3] = {1, 1, 2};
tester(a, b, c, expected);
}
{
int a = 1, b = 1, c = 1;
int expected[3] = {1, 1, 1};
tester(a, b, c, expected);
}
}
static void solution(int a, int b, int c, int *sorted)
{
if(a > b) { int t=a; a=b; b=t; }
if(b > c) { int t=b; b=c; c=t; }
if(a > b) { int t=a; a=b; b=t; }
sorted[0] = a;
sorted[1] = b;
sorted[2] = c;
}
Test(Random_Tests, must_pass_these_also) {
srand(time(NULL));
size_t count = 100;
while(count--) {
int a = rand() % 100 * rand() % 2 ? 1 : -1;
int b = rand() % 100 * rand() % 2 ? 1 : -1;
int c = rand() % 100 * rand() % 2 ? 1 : -1;
int expected[3];
solution(a, b, c, (int *)&expected);
tester(a, b, c, expected);
}
}
```

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Write a function to find the sum of all the multiples of 3 or 5 below n (where is a positive integer).

```
def compute(n):
ans = sum(x for x in range(n) if (x % 3 == 0 or x % 5 == 0))
return ans
```

```
Test.describe("Basic tests")
Test.assert_equals(compute(1000), 233168)
Test.assert_equals(compute(48237), 542917083)
Test.assert_equals(compute(1928), 866894)
Test.assert_equals(compute(758), 133889)
# test.assert_equals(actual, expected, [optional] message)
# test.assert_not_equals(actual, expected, [optional] message)
# You can use Test.describe and Test.it to write BDD style test groupings
```

this is beautiful

```
public class s {
}
```

```
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.runners.JUnit4;
// TODO: Replace examples and use TDD by writing your own tests
public class SolutionTest {
@Test
public void testSomething() {
// assertEquals("expected", "actual");
}
}
```

Write a function `perfect(numbers)`

which will be given a list of numbers, of which at least one is a square. Your job is to output a list which will only return the square numbers from that list. Good luck!

```
def perfect(numbers):
#Code goes here. Good Luck!
return perfected_numbers
```

`test.assert_equals(perfect([2,4,8,16,25]), [4, 16, 25])`

A board represents square sized table with columns named with numbers and rows named with chars as following:

```
| | 1 | 2 | 3 |...
|a| | | |...
|b| | | |...
|c| | | |...
.
.
.
```

Each field is corresponding to specific coordinate this way: a1 -> (0, 0); a2 -> (0, 1), ..., c2 -> (2, 1), c3 -> (2, 2) ...

Size of square board will be less or equal english alphabet's letter count i.e. <= 26. Let's consider that passed parameter is correct and have a value within 'a1'..'z26'.

Your task is to write a function which accepts a field parameter in string representation for example 'a1' and return a tuple respresenting a corresponding coordinate - (rowIndex, columnIndex), e.g. if there was passed 'c1' then result should be (2, 0).

```
import re
def field_to_coordinate(field):
# Compute a coordinate which represents specified `field`,
# i.e. if field = 'd2' returned value should be [3, 1]
x, y = re.search(r"([^\d])(\d+)", field).groups()
return (ord(x) - 97, int(y) - 1)
```

```
test.assert_equals(field_to_coordinate('c1'), (2, 0))
test.assert_equals(field_to_coordinate('d2'), (3, 1))
test.assert_equals(field_to_coordinate('f5'), (5, 4))
```