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.

### Say hello!

Code
Diff
• ``````def myMap(mine):
return [i+1 for i in mine]    ``````
• def myMap(mine):
• l = [i+1 for i in mine]
• return l
• return [i+1 for i in mine]

### Combinations of different groups

Code
Diff
• ``````from itertools import *

def groups_combinations(arr2D):
res = list(product(*arr2D))
return [len(res), res]

``````
• from itertools import *
• def product_(arr2D):
• return product(*arr2D)
• def groups_combinations(arr2D):
• res = []
• for comb in product_(arr2D):
• res.append(comb)
• res = list(product(*arr2D))
• return [len(res), res]

### Distance Between Two Points in a Plane and in the Space.

Code
Diff
• ``````from math import sqrt, pow

# calculate the distance between two points in 2d,3d ... nD
def distanceND(pA, pB, nD = None):
return sqrt(sum(pow(a-b,2) for a,b in zip(pA,pB)))

distance2D = distanceND

distance3D =distanceND

``````
• from math import sqrt, pow
• # calculate the distance between two points in 2d,3d ... nD
• def distanceND(pA, pB, nD = None):
• return sqrt(sum(pow(a-b,2) for a,b in zip(pA,pB)))
• def distance2D(pA, pB):
• return(distanceND(pA, pB))
• distance2D = distanceND
• def distance3D(pA, pB):
• return(distanceND(pA, pB))
• distance3D =distanceND
Failed Tests

### Bubble sort implemented in GO

This is the real "bubble sort", your implementation similar to "selection sort" =)

Code
Diff
• ``````package main

import "fmt"

func bubble_sort(dataset []int){
for i := 1; i <= len(dataset)-1; i++ {

if dataset[i] >= dataset[i-1] { continue }

var y int = dataset[i]
var j int = i - 1

for {
if j < 0 || dataset[j] <= y { break }
dataset[j+1] = dataset[j]
j--
}

dataset[j+1] = y
}
}

func main(){

dataset := []int{5, 2, 4, 6, 1, 3, 15, 6, 23645, 23, 462, 2, 2, -12};

fmt.Println(dataset)

bubble_sort(dataset);

fmt.Println(dataset)
}
``````
• package main
• import "fmt"
• func swap(dataset []int, a, b int) {
• var x int = dataset[a]
• dataset[a] = dataset[b]
• dataset[b] = x
• }
• func bubble_sort(dataset []int){
• for i := 0; i <= len(dataset)-1; i++ {
• for j := len(dataset)-1; j >= i + 1; j-- {
• if dataset[j] < dataset[j-1] {
• swap(dataset, j, j - 1)
• for i := 1; i <= len(dataset)-1; i++ {
• if dataset[i] >= dataset[i-1] { continue }
• var y int = dataset[i]
• var j int = i - 1
• for {
• if j < 0 || dataset[j] <= y { break }
• dataset[j+1] = dataset[j]
• j--
• }
• }
• dataset[j+1] = y
• }
• }
• func main(){
• dataset := []int{5, 2, 4, 6, 1, 3};
• dataset := []int{5, 2, 4, 6, 1, 3, 15, 6, 23645, 23, 462, 2, 2, -12};
• fmt.Println(dataset)
• bubble_sort(dataset);
• fmt.Println(dataset)
• }

### Last Char

Strings
Data Types
Code
Diff
• ``````def last_char(s):
return s[-1]``````
• last_char = lambda s: s[-1]
• def last_char(s):
• return s[-1]

### Find the nth Fibonacci number

Code
Diff
• ``````from functools import lru_cache

@lru_cache()
def fib(n):
if n < 2: return 1
return fib(n-1) + fib(n-2)
``````
• from functools import lru_cache
• @lru_cache()
• def fib(n):
• memo = {0:1, 1:1}
• def recursiveFib(n):
• if n not in memo:
• memo[n] = recursiveFib(n-1)+recursiveFib(n-2)
• return memo[n]
• return recursiveFib(n)
• if n < 2: return 1
• return fib(n-1) + fib(n-2)