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
  • spawn_to_range=lambda a,v,r:a[:a.index(v)]+[v]*r+a[a.index(v)+1:]
    • def spawn_to_range(arr, val, ran):
    • i = arr.index(val)
    • return arr[:i]+[val]*ran+arr[i+1:]
    • spawn_to_range=lambda a,v,r:a[:a.index(v)]+[v]*r+a[a.index(v)+1:]
Code
Diff
  • exec(bytes("潦‽慬扭慤愠‬⁢›楛映牯椠椠⁡晩椠渠瑯椠嵢", "u16")[2:])
    • foo = lambda a, b : list(set(a) - set(b))
    • exec(bytes("潦‽慬扭慤愠‬⁢›楛映牯椠椠⁡晩椠渠瑯椠嵢", "u16")[2:])

w/ IntStream.sorted()

Code
Diff
  • import static java.util.stream.IntStream.of;
    
    interface HighLow {
      static int[] findLargestAndSmallest(int[] nums) {
        if (nums == null || nums.length == 0) return null;
        int[] sorted = of(nums).sorted().toArray();
        return new int[] {sorted[0], sorted[sorted.length - 1]};
      }
    }
    
    • import java.util.stream.IntStream;
    • import java.util.IntSummaryStatistics;
    • import static java.util.stream.IntStream.of;
    • interface HighLow {
    • static int[] findLargestAndSmallest(int[] nums) {
    • if(nums == null || nums.length == 0) return null;
    • IntSummaryStatistics stats = IntStream.of(nums).summaryStatistics();
    • return new int[]{stats.getMin(), stats.getMax()};
    • if (nums == null || nums.length == 0) return null;
    • int[] sorted = of(nums).sorted().toArray();
    • return new int[] {sorted[0], sorted[sorted.length - 1]};
    • }
    • }

To have the function display whatever name that you want you can write it in the following ways.

function greetings(name){
  return `My name is: ${name}`
}
//For greetings(aName); the output would be "My name is aName"


const greetings = (name) => `My name is: ${name}`;
//For greetings(anotherName) the output would be "My name is anotherName"


const greetings = (n) => `My name is: ${n}`;
//For greetings(thisName); the output would be "My name is thisName"

This would make the previous code more flexible if you so desire.

Code
Diff
  • function greetings(){
      return 'My name is: seraph776'
    }
    
    • const greetings = () => "My name is: seraph776"
    • function greetings(){
    • return 'My name is: seraph776'
    • }
Code
Diff
  • const power = (a, b) => a ** b
    • const power = (a, b) => a === 0 ? 1 : a ** b;
    • const power = (a, b) => a ** b