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.

Ad
Ad

qwe

Code
Diff
  • const rps=(a, b)=>a==b?'Draw!':'Player '+(['scissorsrock','paperscissors','rockpaper'].includes(a+b)+1)+' won!';
    
    • function rps(player1, player2) {
    • return player1 == player2 ? 'Draw!' :
    • player1 == 'rock' && player2 == 'scissors' ||
    • player1 == 'scissors' && player2 == 'paper' ||
    • player1 == 'paper' && player2 == 'rock' ? 'Player 1 won!' : 'Player 2 won!';
    • }
    • const rps=(a, b)=>a==b?'Draw!':'Player '+(['scissorsrock','paperscissors','rockpaper'].includes(a+b)+1)+' won!';
Code
Diff
  • const numMinusSeven = num => {
      let youGoodBro = [];
      while (num > 0) youGoodBro.push(num -= 7);
        
      return youGoodBro.length;
    }
    • const numMinusSeven = function(num) {
    • const numMinusSeven = num => {
    • let youGoodBro = [];
    • while (num > 0) {
    • num -= 7;
    • youGoodBro.push(num);
    • }
    • while (num > 0) youGoodBro.push(num -= 7);
    • return youGoodBro.length;
    • }
Code
Diff
  • fun sum(array: IntArray) = array.reduce { sum, element -> sum + element }
    • def sum(arr):
    • result = 0
    • for i in arr:
    • result += i
    • return result
    • fun sum(array: IntArray) = array.reduce { sum, element -> sum + element }
Code
Diff
  • using System.Collections.Generic;
    using System.Linq;
    public class Kata
    {
        /// <summary>
        /// Checks if two char arrays contain at least one common item.
        /// </summary>
        /// <param name="a">First char array</param>
        /// <param name="b">Second char array</param>
        /// <returns>True if the arrays have at least one common item, false otherwise</returns>
    public static bool ContainsCommonItem(char[] a, char[] b) => (a == null || b == null) ? false : a.Intersect(b).Any();    
    
    
    • using System.Collections.Generic;
    • using System.Linq;
    • public class Kata
    • {
    • /// <summary>
    • /// Checks if two char arrays contain at least one common item.
    • /// </summary>
    • /// <param name="a">First char array</param>
    • /// <param name="b">Second char array</param>
    • /// <returns>True if the arrays have at least one common item, false otherwise</returns>
    • public static bool ContainsCommonItem(char[] a, char[] b)
    • {
    • // If either input array is null, return false
    • if (a == null || b == null) return false;
    • public static bool ContainsCommonItem(char[] a, char[] b) => (a == null || b == null) ? false : a.Intersect(b).Any();
    • return a.Intersect(b).Any();
    • }
    • }
Code
Diff
  • #include<iostream>
    
    int doubleValue(int x) {
        return x << 1;
    }
    
    • #include<iostream>
    • int doubleValue(int x) {
    • return x * 2;
    • return x << 1;
    • }
Code
Diff
  • def solution(roman):
        roman_numbers = {
            'I': 1,
            'II': 2,
            'III': 3,
            'IV': 4,
            'V': 5,
            'VI': 6,
            'VII': 7,
            'VIII': 8,
            'IX': 9,
            'X': 10,
            'XL': 40,
            'L': 50,
            'XC': 90,
            'C': 100,
            'CD': 400,
            'D': 500,
            'CM': 900,
            'M': 1000,
        }
    
        n = 0
        i = len(roman)
        while roman:
            s = roman[: i + 1]
            d = roman_numbers.get(s)
            if d:
                n += d
                roman = roman[i + 1 :]
                i = len(roman)
            else:
                i -= 1
        return n
    
    
    • package kata
    • def solution(roman):
    • roman_numbers = {
    • 'I': 1,
    • 'II': 2,
    • 'III': 3,
    • 'IV': 4,
    • 'V': 5,
    • 'VI': 6,
    • 'VII': 7,
    • 'VIII': 8,
    • 'IX': 9,
    • 'X': 10,
    • 'XL': 40,
    • 'L': 50,
    • 'XC': 90,
    • 'C': 100,
    • 'CD': 400,
    • 'D': 500,
    • 'CM': 900,
    • 'M': 1000,
    • }
    • n = 0
    • i = len(roman)
    • while roman:
    • s = roman[: i + 1]
    • d = roman_numbers.get(s)
    • if d:
    • n += d
    • roman = roman[i + 1 :]
    • i = len(roman)
    • else:
    • i -= 1
    • return n
    • func Decode(roman string) int {
    • return 0
    • }
Code
Diff
  • const addArr = (arr) => arr?.length ? arr.reduce((sum, num) => sum + num, 0) : null;
    • function addArr(arr){
    • if(arr.length === 0) return null
    • let final = 0
    • arr.forEach(num => {
    • final += num
    • })
    • return final
    • }
    • const addArr = (arr) => arr?.length ? arr.reduce((sum, num) => sum + num, 0) : null;
Code
Diff
  • def should_return_1():
        return 1
    #1
    • def should_return_1():
    • return 1
    • return 1
    • #1
Code
Diff
  • const returnInputNumber = (n) => +n || 0;
    • const returnInputNumber = (n = 0) => {
    • return typeof n === "number" ? n : 0;
    • };
    • const returnInputNumber = (n) => +n || 0;