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
Code
Diff
  • divisors=lambda n:[x for x in range(1,n+1)if n%x==0]
    • def divisors(number):
    • return [i for i in range(1,number+1) if number % i == 0]
    • divisors=lambda n:[x for x in range(1,n+1)if n%x==0]
Code
Diff
  • def find_max(arr):
        arr.sort()
        return arr[-1]
    • def find_max(arr):
    • max = 0
    • for i in range(len(arr)):
    • if arr[i] > max:
    • max = arr[i]
    • return max
    • arr.sort()
    • return arr[-1]

FizzBuzz using pattern matching

Code
Diff
  • using System;
    
    namespace Solution {
      class FizzBuzz {
        public static string Convert(int input) => input switch
        {
          {} when input.IsDivisibleBy(3) && input.IsDivisibleBy(5) => "FizzBuzz",
          {} when input.IsDivisibleBy(3) => "Fizz",
          {} when input.IsDivisibleBy(5) => "Buzz",
          _ => input.ToString()
        };
      }
      
      static class IntExtensions {
        public static bool IsDivisibleBy(this int dividend, int divisor) => dividend % divisor == 0;
      }
    }
    • using System;
    • namespace Solution {
    • class FizzBuzz {
    • public static string Convert(int input)
    • {
    • var divisableBy3 = input % 3 == 0;
    • var divisableBy5 = input % 5 == 0;
    • return (!divisableBy3 & !divisableBy5) ? input.ToString()
    • : (divisableBy3 ? "Fizz" : string.Empty) + (divisableBy5 ? "Buzz" : string.Empty);
    • }
    • public static string Convert(int input) => input switch
    • {
    • {} when input.IsDivisibleBy(3) && input.IsDivisibleBy(5) => "FizzBuzz",
    • {} when input.IsDivisibleBy(3) => "Fizz",
    • {} when input.IsDivisibleBy(5) => "Buzz",
    • _ => input.ToString()
    • };
    • }
    • static class IntExtensions {
    • public static bool IsDivisibleBy(this int dividend, int divisor) => dividend % divisor == 0;
    • }
    • }
Code
Diff
  • isEven=x=>!(x%2)
    • function isEven(input) {
    • return input%2===0;
    • }
    • isEven=x=>!(x%2)
Code
Diff
  • function kumite(arr) {
        var copy = [...arr];
        for(var i=0; i<copy.length-1; i++){
            if(copy[i] == copy[i+1]){
                for(var j=i+1; copy[j] == copy[i]; j++);
                copy.splice(i, j-i);
                i--;
            }
        }
        return copy;
    }
    • function kumite(arr) {
    • return [];
    • var copy = [...arr];
    • for(var i=0; i<copy.length-1; i++){
    • if(copy[i] == copy[i+1]){
    • for(var j=i+1; copy[j] == copy[i]; j++);
    • copy.splice(i, j-i);
    • i--;
    • }
    • }
    • return copy;
    • }
Code
Diff
  • f=str.__mul__
    • Kata=lambda x,y: x*y
    • # Alternative:
    • # def Kata(string, num):
    • # return string*num
    • f=str.__mul__