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
  • open Preloaded;
    
    let fib = (n) => {
      let rec fib_aux = (n, a, b) =>
        if (n <= 0) { a; }
        else { fib_aux(n - 1, b, a +@ b); }
      fib_aux(n, big_int_of_int(0), big_int_of_int(1))
        |> string_of_big_int;
    };
    
    let fib64 = (n) => {
      // Open Int64 locally
      open Int64;
      let rec fib_aux = (n, a, b) =>
        if (n <= 0) { a; }
        else { fib_aux(n - 1, b, add(a, b)); }
      fib_aux(n, zero, one)
        |> to_string;
    };
    
    • open Preloaded;
    • let fib = (n) => {
    • let rec fib_aux = (n, a, b) =>
    • if (n <= 0) { a; }
    • else { fib_aux(n - 1, b, a +@ b); }
    • fib_aux(n, big_int_of_int(0), big_int_of_int(1))
    • |> string_of_big_int;
    • };
    • let fib64 = (n) => {
    • // Open Int64 locally
    • open Int64;
    • let rec fib_aux = (n, a, b) =>
    • if (n <= 0) { a; }
    • else { fib_aux(n - 1, b, add(a, b)); }
    • fib_aux(n, zero, one)
    • |> to_string;
    • };
Code
Diff
  • av = n => Math.abs(n);
    • function av(num) {
    • return Math.abs(num);
    • }
    • av = n => Math.abs(n);
Algorithms
Logic

We have n piles of apples, and we want to get them together.
Once a time we can combine two piles of apples with a and b apples seperately together, using a+b forces. We want to know the minimum forces we use to combine all piles of apples together.
Input:
apple(n,lst)
where lst contains n numbers representing the number of apples in each pile

Code
Diff
  • function getChange(allPrice,youMoney) {
      return parseFloat((youMoney-allPrice).toFixed(1));
    }
    • function getChange(allPrice,youMoney){
    • return parseFloat((1-(allPrice/youMoney)).toFixed(4))*youMoney;
    • function getChange(allPrice,youMoney) {
    • return parseFloat((youMoney-allPrice).toFixed(1));
    • }
Code
Diff
  • export const example = () => {
    return "O homem do pacote tem é medo!"
    }
    • export const example = () => {
    • return 1
    • return "O homem do pacote tem é medo!"
    • }

num -> string -> array -> [sort(), reverse()] -> string -> num

JS is fun!

Code
Diff
  • const descendingOrder = n =>
      +[...''+n].sort().reverse().join``;
    • function descendingOrder(n){
    • return Number(String(n).split('').sort(function(a, b){return b-a}).join(''));
    • }
    • const descendingOrder = n =>
    • +[...''+n].sort().reverse().join``;