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
Fundamentals
Logic

Vectorized instructions to immensely speed up search process

Code
Diff
  • using System.Diagnostics;
    using System.Numerics;
    using System.Linq;
    
    public class Math
    {
        public static int Max(params int[] nums)
        {
            var blockSize = Vector<int>.Count;
            var blockCount = nums.Length / blockSize;
    
            var vectorMax = Vector<int>.Zero;
            for (var block = 0; block < blockCount; block++)
            {
                var blockIndex = block * blockSize;
                var blockVector = new Vector<int>(nums, blockIndex);
                vectorMax = Vector.Max(vectorMax, blockVector);
            }
    
            var max = MaxWithinVector(vectorMax);
            var leftover = nums.Length % blockSize;
            for (var i = nums.Length - leftover; i < nums.Length; i++)
            {
                max = System.Math.Max(nums[i], max);
            }
    
            Debug.Assert(max == nums.Max());
            return max;
        }
    
        public static int MaxWithinVector(Vector<int> vector)
        {
            var max = vector[0];
            for (var i = 1; i < Vector<int>.Count; i++)
            {
                max = System.Math.Max(vector[i], max);
            }
    
            return max;
        }
    }  
    • using System.Diagnostics;
    • using System.Numerics;
    • using System.Linq;
    • public class Math
    • {
    • public static int Max(params int[] param) => param.Max();
    • public static int Max(params int[] nums)
    • {
    • var blockSize = Vector<int>.Count;
    • var blockCount = nums.Length / blockSize;
    • var vectorMax = Vector<int>.Zero;
    • for (var block = 0; block < blockCount; block++)
    • {
    • var blockIndex = block * blockSize;
    • var blockVector = new Vector<int>(nums, blockIndex);
    • vectorMax = Vector.Max(vectorMax, blockVector);
    • }
    • var max = MaxWithinVector(vectorMax);
    • var leftover = nums.Length % blockSize;
    • for (var i = nums.Length - leftover; i < nums.Length; i++)
    • {
    • max = System.Math.Max(nums[i], max);
    • }
    • Debug.Assert(max == nums.Max());
    • return max;
    • }
    • public static int MaxWithinVector(Vector<int> vector)
    • {
    • var max = vector[0];
    • for (var i = 1; i < Vector<int>.Count; i++)
    • {
    • max = System.Math.Max(vector[i], max);
    • }
    • return max;
    • }
    • }
Code
Diff
  • def even_or_odd(n):  
        return 'Odd' if n&1 else 'Even'
        
        
        
    
    • def even_or_odd(n):
    • return 'Even' if n % 2 == 0 else 'Odd'
    • return 'Odd' if n&1 else 'Even'
Algorithms
Mathematics

i changed !(e<=1) to e>1 ه_ه
i mean $_$>1
its the same thing ok ?
stop being mad at stuped things like this
life isn't just mad life is cool and bool
witch can be true or false depends on
the use, u know what i mean ? u feel me?
u sence where im going ? no ? ok

bye <3

Code
Diff
  • function prime_checker($_$){
      return $_$>1 && [...Array(Math.ceil(Math.sqrt($_$))).keys()].slice(2).every(r=>$_$%r)}
    • function prime_checker(e){return!(e<=1)&&
    • [...Array(Math.ceil(Math.sqrt(e))).keys()].slice(2).every(r=>e%r)}
    • function prime_checker($_$){
    • return $_$>1 && [...Array(Math.ceil(Math.sqrt($_$))).keys()].slice(2).every(r=>$_$%r)}
Code
Diff
  • class FirstKumite{
      public static function something(n:String) 
      {
         return n == '' ? 'Nothing' : n;
      }
    }
    • class FirstKumite{
    • public static function string(n:String)
    • public static function something(n:String)
    • {
    • if(n == '')
    • {
    • n = 'Nothing';
    • }
    • return n;
    • return n == '' ? 'Nothing' : n;
    • }
    • }
Code
Diff
  • #!/bin/bash
    
    echo Hello Bash!
    
    if [ $# -eq 1 ]; then
      echo "Hello, $1!"
    else
      echo "No parameters found."
    fi
Code
Diff
  • unsigned long long div2(unsigned long long a) {
      return a / 2;
    }
    • unsigned long long div2(unsigned long long a){
    • return (a / 2);
    • unsigned long long div2(unsigned long long a) {
    • return a / 2;
    • }
Code
Diff
  • bool isLeap(long n) {
        return (n % 4 == 0 && n % 100 != 0) || (n % 400 == 0);
    }
    • bool isLeap(long n) {
    • if ((n % 4 == 0 && n % 100 != 0) || (n % 400 == 0))
    • return true;
    • return false;
    • return (n % 4 == 0 && n % 100 != 0) || (n % 400 == 0);
    • }
Code
Diff
  • int returnhundred()
    {
      return 100;
    }
    • int returnhundred()
    • {
    • return 'h' ^ 'u' ^ 'n' ^ 'd' ^ 'r' ^ 'e' ^ 'd';
    • return 100;
    • }