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
  • function soma(a, b) {
     return a + b
    }
    • function soma(a, b) {
    • return a + b
    • }
Code
Diff
  • function ronalado(){
    return 'expected';
    }
    • function ronalado(){
    • return 'expected';
    • }
Code
Diff
  • const linkedList = {}; // Generated linked list from input
    
    • const linkedList = {};
    • const linkedList = {}; // Generated linked list from input

Make function negative-safe

Code
Diff
  • def fibonacci(x):
        if x < 0:
            return None
    
        if x == 0 or x == 1:
            return x
    
        return fibonacci(x - 1) + fibonacci(x - 2)
    
    • def fibonacci(x):
    • if x < 0:
    • return None
    • if x == 0 or x == 1:
    • return x
    • else :
    • return fibonacci(x-1) + fibonacci(x-2)
    • return fibonacci(x - 1) + fibonacci(x - 2)
Fundamentals
Arrays
Data Types

The original solution did not cover for empty string.
Also, you can remove completly the sum part from the reduce as to make it simpler to read.

Code
Diff
  • const sum = (a,b) => a+b;
    const getSum = array => array.reduce(sum,0);
    • const getSum = array => array.reduce((acc, i) => acc + i)
    • const sum = (a,b) => a+b;
    • const getSum = array => array.reduce(sum,0);

Just another way... A ternary way.

Code
Diff
  • public class BiggerNum{
    
      /**
       * @param a integer of param1
       * @param b integer of param2
       * @return the bigger integer of a and b
       * If a equals b, return either one
       */
      public static int compare(int a, int b) {
        return a > b ? a : a < b ? b : a;
      }
    }
    • public class BiggerNum{
    • /**
    • * @param a integer of param1
    • * @param b integer of param2
    • * @return the bigger integer of a and b
    • * If a equals b, return either one
    • */
    • public static int compare(int a, int b) {
    • return Math.max(a,b);
    • return a > b ? a : a < b ? b : a;
    • }
    • }
Code
Diff
  • class add:
        def __new__(self, x, y): return x + y
            
    • class add:
    • def __new__(self, x, y):
    • return x + y
    • def __new__(self, x, y): return x + y
Code
Diff
  • def decrypt(message):
        decode = ''
        modifier = -1
        shift = int((len(message) -1) / 2)
        
        for i in range(len(message)):
            shift += i * modifier
            decode += message[shift]
            modifier *= -1
                
        return decode
    • import math
    • def decrypt(message):
    • # JUST DO IT
    • return message
    • decode = ''
    • modifier = -1
    • shift = int((len(message) -1) / 2)
    • for i in range(len(message)):
    • shift += i * modifier
    • decode += message[shift]
    • modifier *= -1
    • return decode
Code
Diff
  • import random
    
    
    def pi_estimate(n, seed=0):
    
        random.seed(seed)
    
        n_inside = 0
        for i in range(n):
            if random.random()**2 + random.random()**2 < 1:
                n_inside += 1
        return 4 * (n_inside / n)
    • import random
    • def PiEstimate(runs):
    • random.seed(0)
    • inner = 0
    • def pi_estimate(n, seed=0):
    • random.seed(seed)
    • n_inside = 0
    • for i in range(n):
    • if random.random()**2 + random.random()**2 < 1:
    • inner += 1
    • return 4 * (inner / n)
    • n_inside += 1
    • return 4 * (n_inside / n)