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.

### Remove Element from Array

Arrays
Data Types
Code
Diff
• ``var remove = (arr, n) => n in arr?(arr.splice(n, 1), arr):arr;``
• function remove (arr, n) {
• if (n < 0 || n >= arr.length) return arr;
• arr.splice(n, 1);
• return arr;
• }
• var remove = (arr, n) => n in arr?(arr.splice(n, 1), arr):arr;

Simplest inversion

Code
Diff
• ``````// write a add function that doesn't use the plus symbol
return -(-a - b);
}``````
• // write a add function that doesn't use the plus symbol
• return --a - ~b;
• return -(-a - b);
• }
Failed Tests

### Word Shuffler

Code
Diff
• ``````# shuffle = lambda st: " ".join(x[::-1] for x in st.split())
#
# 'shuffle()' does the same as 'reverse_word_chars()' below

def reverse_words(s):
"""returns string that is just like s except that the word order is
reversed."""
return ' '.join(reversed(s.split()))

def reverse_chars(s):
"""returns string whose char order is mirror image of s """
return ''.join(reversed(s))

def reverse_word_chars(s):
"""returns string that is just like s except that the letters in each word
are reversed"""
return ' '.join(reversed(x) for x in s.split())
``````
• shuffle = lambda st: " ".join(x[::-1] for x in st.split())
• # shuffle = lambda st: " ".join(x[::-1] for x in st.split())
• #
• # 'shuffle()' does the same as 'reverse_word_chars()' below
• def reverse_words(s):
• """returns string that is just like s except that the word order is
• reversed."""
• return ' '.join(reversed(s.split()))
• def reverse_chars(s):
• """returns string whose char order is mirror image of s """
• return ''.join(reversed(s))
• def reverse_word_chars(s):
• """returns string that is just like s except that the letters in each word
• are reversed"""
• return ' '.join(reversed(x) for x in s.split())

### Hello Python!

Code
Diff
• ``````from ctypes import *

libc = CDLL("libc.so.6")
s="Hello Python!\n"

libc.printf(s.encode())
``````
• from ctypes import *
• libc = CDLL("libc.so.6")
• s="Hello Python!\n"
• # for python 2.7.6
• libc.printf(s)
• #for python 3.4.3
• for c in s:
• libc.printf(c)
• libc.printf(s.encode())

### Return Largest Possible Number

Code
Diff
• ``````function solution (nums){
if (nums.length<2) return nums.join("")
var lens=nums.map(x=>(x+"").length).sort((a,b)=>b-a),maxlen=lens[0]+lens[1],zeros="0".repeat(maxlen),
firsttwo=nums.reduce((a,b,i)=>a.concat(nums.map((c,j)=>i==j?[0,0,"0"]:[b,c,(""+b+c+zeros).slice(0,maxlen)])),[]).sort((a,b)=>b[2]-a[2]).filter((x,i,ar)=>x[2]==ar[0][2])
return firsttwo.map(x=>""+x[0]+x[1]+solution(nums.filter((y,i)=>i!=nums.indexOf(x[0])&&i!=nums.indexOf(x[1])))).sort((a,b)=>b-a)[0]
}
``````
• def solution (nums)
• # slower but simple ;-)
• nums.permutation.to_a.map{|x| x.join("")}.sort{|a,b| b.to_i-a.to_i}[0]
• end
• function solution (nums){
• if (nums.length<2) return nums.join("")
• var lens=nums.map(x=>(x+"").length).sort((a,b)=>b-a),maxlen=lens[0]+lens[1],zeros="0".repeat(maxlen),
• firsttwo=nums.reduce((a,b,i)=>a.concat(nums.map((c,j)=>i==j?[0,0,"0"]:[b,c,(""+b+c+zeros).slice(0,maxlen)])),[]).sort((a,b)=>b[2]-a[2]).filter((x,i,ar)=>x[2]==ar[0][2])
• return firsttwo.map(x=>""+x[0]+x[1]+solution(nums.filter((y,i)=>i!=nums.indexOf(x[0])&&i!=nums.indexOf(x[1])))).sort((a,b)=>b-a)[0]
• }

### Basic Power Function

Fundamentals
Code
Diff
• ``````using System.Numerics;

public class basic
{
public static BigInteger pow(long down, long up)
=> up == 0 ? 1 : down * pow(down, up - 1);
}``````
• using System.Numerics;
• public class basic
• {
• public static BigInteger pow(long down, long up)
• {
• return up == 0 ? 1 : down * pow(down, up - 1);
• }
• => up == 0 ? 1 : down * pow(down, up - 1);
• }

### Rust Testings...

Code
Diff
• ``````// Code is in the preload
fn person_builder(first_name:&'static str, last_name: &'static str) -> Person {
Person { first_name: first_name, last_name: last_name }
}``````
• // Code is in the preload
• // Code is in the preload
• fn person_builder(first_name:&'static str, last_name: &'static str) -> Person {
• Person { first_name: first_name, last_name: last_name }
• }