Start a new Kumite
AllAgda (Beta)BF (Beta)CCFML (Beta)ClojureCOBOL (Beta)CoffeeScriptCommonLisp (Beta)CoqC++CrystalC#D (Beta)DartElixirElm (Beta)Erlang (Beta)Factor (Beta)Forth (Beta)Fortran (Beta)F#GoGroovyHaskellHaxe (Beta)Idris (Beta)JavaJavaScriptJulia (Beta)Kotlinλ Calculus (Beta)LeanLuaNASMNim (Beta)Objective-C (Beta)OCaml (Beta)Pascal (Beta)Perl (Beta)PHPPowerShell (Beta)Prolog (Beta)PureScript (Beta)PythonR (Beta)RacketRaku (Beta)Reason (Beta)RISC-V (Beta)RubyRustScalaShellSolidity (Beta)SQLSwiftTypeScriptVB (Beta)
Show only mine

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.

Failed Tests

### 3 farmer problems

you are a farmer entering a leg competition.
the aim of the competition is to see which farmer has the most legs amounst their animals

you are given three variables:
cow,sheep,chicken

you must use these variables to work out how many legs the farmer has in total

cow: 4legs
sheep: 4legs
chicken: 2legs
count_legs(2,3,10) -> 40

``````def countlegs(cow,sheep,chick):
return cow*4 + sheep*4 +chick*2``````

### Euclid’s Formula

Find Pythagorean triples with Euclid's Formula. The formula is - with a>b, find a squared + b squared, a squared - b squared, and 2 x a x b. Give the result as the the three answers in a list sorted from smallest to biggest

``````def find_triple(a, b):
ans1 = a**2 + b**2
ans2 = a**2 - b**2
ans3 = 2 * a * b
triple = [ans1, ans2, ans3]
triple.sort()
return triple``````
Failed Tests

### C++ Simple Calculator

Create a simple calculator and pass all the tests. The choice, x, and y are all given to you as ints. Just figure out how to fix the rest.

``````#include <iostream>
using namespace std;

string die() {
return "Invalid Input!";
}

string Calculator(int choice, int x, int y) {
cout << "Welcome to simple calculator!\n";
cout << "1. Addition\n2. Subtraction\n3. Multiplication\n4. Division\n5. Modulus\n";
// YOU: Write code to finish this program (Input is given, don't use cin)
// Instead of cout << x + y << endl; for example, do return (x + y);
// You can call the die function with die();
}``````
Failed Tests

Return all of the visited nodes in an array (as integers).

``````function dfs(adjacencyList, source) {
return [];
}``````
Failed Tests

### TS `flat`

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

### Merge Sort in Golang

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))
}``````
Failed Tests

### Output matchs examples, but not working??

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)``````
Failed Tests

### zach2!'s Kumite #2

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

### Powerset

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]

``````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``````

### Function To Sort Three Numbers

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;

}``````