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
  • (ns reverseint.core)
    
    (defn reverse-int' [acc x] 
      (let [quot-rem (.divideAndRemainder
                      x
                      java.math.BigInteger/TEN)]
        (if (= (nth quot-rem 0) 0) (+ (* 10 acc) (nth quot-rem 1)) 
          (reverse-int' (+ (* 10 acc) (nth quot-rem 1)) (nth quot-rem 0)))))
    
    (defn reverse-int [n] 
      (let [quot-rem (.divideAndRemainder 
                      (biginteger n) 
                      java.math.BigInteger/TEN)]
        (reverse-int' (nth quot-rem 1) (nth quot-rem 0))))
    
    
    • public class Algorithms {
    • public static int reverseInt(int n) {
    • int reversed = 0;
    • while(n != 0){
    • reversed = reversed * 10 + (n % 10);
    • n /= 10;
    • }
    • return reversed;
    • }
    • }
    • (ns reverseint.core)
    • (defn reverse-int' [acc x]
    • (let [quot-rem (.divideAndRemainder
    • x
    • java.math.BigInteger/TEN)]
    • (if (= (nth quot-rem 0) 0) (+ (* 10 acc) (nth quot-rem 1))
    • (reverse-int' (+ (* 10 acc) (nth quot-rem 1)) (nth quot-rem 0)))))
    • (defn reverse-int [n]
    • (let [quot-rem (.divideAndRemainder
    • (biginteger n)
    • java.math.BigInteger/TEN)]
    • (reverse-int' (nth quot-rem 1) (nth quot-rem 0))))
Fundamentals
Numbers
Data Types
Integers
Code
Diff
  • #include <bitset>
    
    #define KATA_SUBSCRIPT
    
    namespace Kata
    {
        bool IsOdd(int input)
        {
            return std::bitset<1>(input)
    #if defined KATA_EQUALS
                == std::bitset<1>(1);
    #elif defined KATA_NOT_EQUALS
                != std::bitset<1>(0);
    #elif defined KATA_SUBSCRIPT
                [0];
    #elif defined KATA_TEST
                .test(0);
    #elif defined KATA_ALL
                .all();
    #elif defined KATA_ANY
                .any();
    #elif defined KATA_NONE
                .none() != true;
    #elif defined KATA_COUNT
                .count();
    #elif defined KATA_TO_STRING
                .to_string() == "1";
    #elif defined KATA_TO_ULONG
                .to_ulong();
    #elif defined KATA_TO_ULLONG
                .to_ullong();
    #else 
                you have to choose something
    #endif
        }
    }
    • public static class Kata
    • #include <bitset>
    • #define KATA_SUBSCRIPT
    • namespace Kata
    • {
    • public static bool IsOdd(int input)
    • bool IsOdd(int input)
    • {
    • return ((input % 10 == 1) || (input % 10 == 3) || (input % 10 == 5) || (input % 10 == 7) || (input % 10 == 9));
    • return std::bitset<1>(input)
    • #if defined KATA_EQUALS
    • == std::bitset<1>(1);
    • #elif defined KATA_NOT_EQUALS
    • != std::bitset<1>(0);
    • #elif defined KATA_SUBSCRIPT
    • [0];
    • #elif defined KATA_TEST
    • .test(0);
    • #elif defined KATA_ALL
    • .all();
    • #elif defined KATA_ANY
    • .any();
    • #elif defined KATA_NONE
    • .none() != true;
    • #elif defined KATA_COUNT
    • .count();
    • #elif defined KATA_TO_STRING
    • .to_string() == "1";
    • #elif defined KATA_TO_ULONG
    • .to_ulong();
    • #elif defined KATA_TO_ULLONG
    • .to_ullong();
    • #else
    • you have to choose something
    • #endif
    • }
    • }
Code
Diff
  • def Hello_Python(a='Hello',b='Python!'):
        return a + b
    • System.Console.WriteLine("Hello, C#!");
    • def Hello_Python(a='Hello',b='Python!'):
    • return a + b
Code
Diff
  • def find_max(arr):
        return max(arr)
    • def find_max(arr):
    • return 0
    • return max(arr)
Code
Diff
  • add = +
    • // write a add function that doesn't use the plus symbol
    • function add(a, b){
    • return a + b;
    • }
    • // Make sure to view the test cases to see how this test fails
    • add = +
Code
Diff
  • print ('hello world');
    • print ('hello world)
    • print ('hello world');
Code
Diff
  • function monteCarlo() {
      return new Promise(function (resolve, reject) {
        reject({server: 'down'});
      });
    }
    
    async function main() {
    
      // converter para ES6
     try{
       const results = await monteCarlo();
      }catch(e) {
      
    }
      return true;
    }
    • function monteCarlo() {
    • return new Promise(function (resolve, reject) {
    • reject({server: 'down'});
    • });
    • }
    • async function main() {
    • // converter para ES6
    • const results = await monteCarlo();
    • try{
    • const results = await monteCarlo();
    • }catch(e) {
    • }
    • return true;
    • }
Code
Diff
  • function monteCarlo() {
      return new Promise(function (resolve, reject) {
        resolve([{
          titulo: 'UOL - O Melhor conteúdo'
        }]);
      });
    }
    
    async function main() {
      const response = await monteCarlo()
      
      return true;
    }
    • function monteCarlo() {
    • return new Promise(function (resolve, reject) {
    • resolve([{
    • titulo: 'UOL - O Melhor conteúdo'
    • }]);
    • });
    • }
    • async function main() {
    • // converter para ES6
    • monteCarlo().then(function(response) {
    • console.log(response)
    • });
    • const response = await monteCarlo()
    • return true;
    • }
Code
Diff
  • const main = () => {
    
      let a = [1, 2, 3];
      
      let b = [4, 5, 6];
      
      let c = [7, 8, 9];
    
      // converter para ES6
      var d = a.concat(b).concat(c);
      
      return [...a,...b,...c].join(',');
    }
    • const main = () => {
    • let a = [1, 2, 3];
    • let b = [4, 5, 6];
    • let c = [7, 8, 9];
    • // converter para ES6
    • var d = a.concat(b).concat(c);
    • return d.join(',');
    • return [...a,...b,...c].join(',');
    • }
Code
Diff
  • var materia = {
      conteudo: {
        titulo: 'UOL',
      },
      tags: ['São Paulo', 'SP', 'Sudeste', 'Brasil', 'América Latina']
    };
    
    const {conteudo: {titulo}, tags: {uf, regiao}} = materia;
    • var materia = {
    • conteudo: {
    • titulo: 'UOL',
    • },
    • tags: ['São Paulo', 'SP', 'Sudeste', 'Brasil', 'América Latina']
    • };
    • var uf = materia.tags[1];
    • var regiao = materia.tags[2];
    • var titulo = materia.conteudo.titulo;
    • const {conteudo: {titulo}, tags: {uf, regiao}} = materia;