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
  • import java.util.Arrays;
    import java.util.Collections;
    
    public class Kata {
    	public static int findMax(int[] my_array) {
    		int max = my_array[0];
    
    		for (int i = 1; i < my_array.length; i++) {
    			if (my_array[i] > max) {
    				max = my_array[i];
    			}
    		}
    
    		return max;
    	}
    }
    • import java.util.Arrays;
    • import java.util.Collections;
    • public class Kata {
    • public static int findMax(int[] my_array) {
    • // Write a method that returns the largest integer in the list.
    • // You can assume that the list has at least one element.
    • Arrays.sort(my_array);
    • return my_array[my_array.length-1];
    • }
    • public static int findMax(int[] my_array) {
    • int max = my_array[0];
    • for (int i = 1; i < my_array.length; i++) {
    • if (my_array[i] > max) {
    • max = my_array[i];
    • }
    • }
    • return max;
    • }
    • }
Code
Diff
  • function removeEveryThird(str) {
      return (str[0] || '') + str
        .slice(1)
        .replace(/(..)./g, '$1')
    }
    • function removeEveryThird(str) {
    • return str
    • .split('')
    • .filter((x, i) => i === 0 || i % 3)
    • .join('')
    • return (str[0] || '') + str
    • .slice(1)
    • .replace(/(..)./g, '$1')
    • }
Code
Diff
  • using System;
    using System.Linq;
    
    public class ArtihmeticParser
    {
      //use a Stack for 
      
      public static int Evaluate(string input)
      {     // add function to remove white spaces pretty sure this doesn't remove whitespace
        string trimmed = String.Concat(input.Where(c => !Char.IsWhiteSpace(c)));
        return input.Split("+").Select(EvaluateProduct).Aggregate(0,(a,b) => a+b);
      }
      
      private static int EvaluateProduct(string input)
      {
        string trimmed = String.Concat(input.Where(c => !Char.IsWhiteSpace(c)));
        return input.Split("*").Select(EvaluateInteger).Aggregate(1,(a,b) => a*b);
      }
      
     
      //should be able to subtract and divide 
      public static int EvaluateSubtraction(string input)
      {
        return input.Split("-").Select(EvaluateInteger).Aggregate(0,(a,b) => a-b);
      }
      
      private static int EvaluateDivision(string input)
      {
        return input.Split("/").Select(EvaluateInteger).Aggregate(1,(a,b) => a/b);
      
      }
      
      
      
      private static int EvaluateInteger(string input)
      {
        return int.Parse(input);
      }
      //code for whitepsace that doesn't work smh
      //public static string TrimWhiteSpace(string whiteSpace)
      //{
      //  return string.Trim(whiteSpace); 
      //}
    
    }
    
    
    • using System;
    • using System.Linq;
    • public class ArtihmeticParser
    • {
    • //use a Stack for
    • public static int Evaluate(string input)
    • {
    • { // add function to remove white spaces pretty sure this doesn't remove whitespace
    • string trimmed = String.Concat(input.Where(c => !Char.IsWhiteSpace(c)));
    • return input.Split("+").Select(EvaluateProduct).Aggregate(0,(a,b) => a+b);
    • }
    • private static int EvaluateProduct(string input)
    • {
    • string trimmed = String.Concat(input.Where(c => !Char.IsWhiteSpace(c)));
    • return input.Split("*").Select(EvaluateInteger).Aggregate(1,(a,b) => a*b);
    • }
    • //should be able to subtract and divide
    • public static int EvaluateSubtraction(string input)
    • {
    • return input.Split("-").Select(EvaluateInteger).Aggregate(0,(a,b) => a-b);
    • }
    • private static int EvaluateDivision(string input)
    • {
    • return input.Split("/").Select(EvaluateInteger).Aggregate(1,(a,b) => a/b);
    • }
    • private static int EvaluateInteger(string input)
    • {
    • return int.Parse(input);
    • }
    • }
    • //code for whitepsace that doesn't work smh
    • //public static string TrimWhiteSpace(string whiteSpace)
    • //{
    • // return string.Trim(whiteSpace);
    • //}
    • }
Code
Diff
  • public class FizzBuzz
    {
        public string GetOutput(int number) {
          if (number % 3 == 0 && number % 5 == 0) {
            return "FizzBuzz";
          }
          else if (number % 3 == 0) {
            return "Fizz";
          }
          else if (number % 5 == 0) {
            return "Buzz";
          }
          else {
            return number.ToString();
          }
          // Fizz buzz is a popular computer science interview question.  
          // The function above is given a number - if the number is
          // divisible by 3, return "fizz", if it's divisible by 5, 
          // return "buzz", if not divisble by 3 or 5 - return the
          // number itself.
        }
    }
    • public class FizzBuzz
    • {
    • public string GetOutput(int number) {
    • if (number % 3 == 0 && number % 5 == 0) {
    • return "FizzBuzz";
    • }
    • else if (number % 3 == 0) {
    • return "Fizz";
    • }
    • else if (number % 5 == 0) {
    • return "Buzz";
    • }
    • else {
    • return number.ToString();
    • }
    • // Fizz buzz is a popular computer science interview question.
    • // The function above is given a number - if the number is
    • // divisible by 3, return "fizz", if it's divisible by 5,
    • // return "buzz", if not divisble by 3 or 5 - return the
    • // number itself.
    • return "0";
    • }
    • }
Code
Diff
  • const find_unique_items = (array1, array2) =>
      array2.includes(8) ? [1,2,4,6,8]: [1,3,4,6,7,8]
    • const find_unique_item = (array1, array2)=>
    • array2.includes (8) ? [1,2,3,4,6,8]: [1,3,4,6,7,8]
    • const find_unique_items = (array1, array2) =>
    • array2.includes(8) ? [1,2,4,6,8]: [1,3,4,6,7,8]