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
  • //Given 2 Arrays, Return True if arrays contain common item, else false.
    //e.g a= ['a','b','g','c'] and b =['z','e','c'] returns true
    //input : 2 arrays
    //output: bool
    using System.Collections.Generic;
    using System.Linq;
    public class Kata{
      public static bool ContainsCommonItem(char[] a, char[] b){ //not mine
        for(int i=0;i<a.Length;i++)
          for(int j=0; j< b.Length; j++)
            if(a[i]==b[j])
              return true;
        return false;
      }
      public static bool ContainsCommonItemBetter(char[] a,char[]b){ //not min
        
        HashSet<char> items = new HashSet<char>();
        
        foreach(char item in a)
          items.Add(item);
        for (int i =0; i< b.Length; i++)
          if (items.Contains(b[i]))
            return true;
        return false;
      }
      public static bool ContainsCommonItemMoreSimple(char[] a, char[] b) // mine
      {
          var charsExcistingInBoth = a.Intersect(b);
          return charsExcistingInBoth.Count() > 0? true : false;
      }
        
    }
    
    • //Given 2 Arrays, Return True if arrays contain common item, else false.
    • //e.g a= ['a','b','g','c'] and b =['z','e','c'] returns true
    • // naive approach, loop through first array, with each item in a, loop through b and compare item to
    • //each item in b returning true if a match is found or false.
    • //input : 2 arrays
    • //output: bool
    • using System.Collections.Generic;
    • using System.Linq;
    • public class Kata{
    • public static bool ContainsCommonItem(char[] a, char[] b){ //naive O(a*b)
    • public static bool ContainsCommonItem(char[] a, char[] b){ //not mine
    • for(int i=0;i<a.Length;i++)
    • for(int j=0; j< b.Length; j++)
    • if(a[i]==b[j])
    • return true;
    • return false;
    • }
    • public static bool ContainsCommonItemBetter(char[] a,char[]b){
    • public static bool ContainsCommonItemBetter(char[] a,char[]b){ //not min
    • HashSet<char> items = new HashSet<char>();
    • foreach(char item in a)
    • items.Add(item);
    • for (int i =0; i< b.Length; i++)
    • if (items.Contains(b[i]))
    • return true;
    • return false;
    • }
    • public static bool ContainsCommonItemMoreSimple(char[] a, char[] b) // mine
    • {
    • var charsExcistingInBoth = a.Intersect(b);
    • return charsExcistingInBoth.Count() > 0? true : false;
    • }
    • }
Code
Diff
  • const helloWorld = name => `Hello World ${name}`;
    • const helloWorld = (name) => `Hello World ${name}`;
    • const helloWorld = name => `Hello World ${name}`;
Code
Diff
  • package cat;
    public class kata{
      public static int doubleValue(int x) {
        var sum = 0;
        for (var i = 0; i < 2; i++)
          sum += x;
        return sum;
      }
    }
    • package cat;
    • public class kata{
    • public static int doubleValue(int x) {
    • return x * 2;
    • var sum = 0;
    • for (var i = 0; i < 2; i++)
    • sum += x;
    • return sum;
    • }
    • }
Code
Diff
  • class Student:
        def __init__(self, first_name, last_name, grades=None):
            self.first_name = first_name
            self.last_name = last_name
            self.grades = [] if grades is None else grades
    
        @property
        def full_name(self):
            return f'{self.first_name} {self.last_name}'
    
        @property
        def email(self):
            return f'{self.first_name}{self.last_name[0]}@codewars.com'
    
        @property
        def grade_average(self):
            return sum(self.grades) / len(self.grades)
    
        def assess(self):
            if self.grade_average >= 90:
                return "A"
            if self.grade_average >= 80:
                return "B"
            if self.grade_average >= 70:
                return "C"
            if self.grade_average >= 65:
                return "D"
            return "F"
    • class Student:
    • def __init__(self, first_name, last_name, grades=None):
    • self.first_name = first_name
    • self.last_name = last_name
    • self.grades = [] if grades is None else grades
    • @property
    • def full_name(self):
    • return f'{self.first_name} {self.last_name}'
    • @property
    • def email(self):
    • return f'{self.first_name}{self.last_name[0]}@codewars.com'
    • @property
    • def grade_average(self):
    • if len(self.grades) <= 0:
    • return 'New Student'
    • else:
    • return sum(self.grades) / len(self.grades)
    • return sum(self.grades) / len(self.grades)
    • def assess(self):
    • if self.grade_average < 65:
    • return "F"
    • if 65 <= self.grade_average < 70:
    • return "D"
    • if 70 <= self.grade_average < 80:
    • return "C"
    • if 80 <= self.grade_average < 90:
    • return "B"
    • if self.grade_average >= 90:
    • return "A"
    • return "A"
    • if self.grade_average >= 80:
    • return "B"
    • if self.grade_average >= 70:
    • return "C"
    • if self.grade_average >= 65:
    • return "D"
    • return "F"