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.


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:

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

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]
    return triple

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();

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

function dfs(adjacencyList, source) {
  return [];
UnnamedFailed Tests

TS `flat`

console.log('flat' in Array.prototype);

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,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]
		} else if r > len(right)-1 && l <= len(left)-1 {
			slice[i] = left[l]
		} else if left[l] < right[r] {
			slice[i] = left[l]
		} else {
			slice[i] = right[r]
	return slice

func main() {
	arr := []int{3, 4, 1, 2, 5}

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 + " "
def square(ty):
    a = a * a
    return b

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
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:
    for i in subset(L):          #Calling subset(L) for adding subsets to pset
        if i not in pset:
    #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
    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
    while i<len(L):
        #in each iteration removing ith element of List to get a subset
        if List not in S:         #avoiding copies
        #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 
        List=L[:]                #Restoring List after several mutations 
                                 #so that next time mutated list is not
                                 #encountered in line 16
    return S                     #list of subsets

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;