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

fixed. much better now

Code
Diff
  • fn multiply<T: std::ops::Mul<Output = T>>(a: T, b: T) -> T {
        a * b
    }
    • def multiply (a,b):
    • a * b
    • fn multiply<T: std::ops::Mul<Output = T>>(a: T, b: T) -> T {
    • a * b
    • }
Code
Diff
  • def hello_world(world):
        return "Hello World baby" if world else "No World"                                                                                                                                                                                                                                                                       
    • def hello_world(world):
    • if world == True:
    • return "Hello World baby"
    • elif world == False:
    • return "No World"
    • return "Hello World baby" if world else "No World"
Arrays
Sorting
Code
Diff
  • use std::cmp::Reverse;
    
    fn longest_words(words: &[&str], n: usize) -> Vec<String> {
        let mut words: Vec<_> = words
            .iter()
            .map(|word| word.chars().filter(|c| c.is_ascii_alphabetic()).collect::<String>())
            .filter(|word| !word.is_empty())
            .collect();
        words.sort_by_key(|word| Reverse(word.len()));
        words.into_iter().take(n).collect()
    }
    • def longest_words(array, num):
    • new = [k for k in sorted([''.join([i for i in j if 97 <= ord(i) <= 122 or 65 <= ord(i) <= 90]) for j in array], key=lambda x: len(x), reverse=True) if k != '']
    • return new[:num] if num <= len(new) else 'Invalid Parameters'
    • use std::cmp::Reverse;
    • fn longest_words(words: &[&str], n: usize) -> Vec<String> {
    • let mut words: Vec<_> = words
    • .iter()
    • .map(|word| word.chars().filter(|c| c.is_ascii_alphabetic()).collect::<String>())
    • .filter(|word| !word.is_empty())
    • .collect();
    • words.sort_by_key(|word| Reverse(word.len()));
    • words.into_iter().take(n).collect()
    • }
Code
Diff
  • // const reverseStr = str => [...str].reverse().join('');   <-- weak smh
    
    // function reverseStr(str){return str.split("").reverse().join("")}
    
    // console.log(reverseStr('hello world'));
    
    reverseStr = str => str.split("").reverse().join("")
    • // const reverseStr = str => [...str].reverse().join(''); <-- weak smh
    • function reverseStr(str){return str.split("").reverse().join("")}
    • // function reverseStr(str){return str.split("").reverse().join("")}
    • console.log(reverseStr('hello world'));
    • // console.log(reverseStr('hello world'));
    • reverseStr = str => str.split("").reverse().join("")

Examples:

sum of odd (0, 5) -> 0 + 3 + 5 -> 8
sum of odd (0, 9) -> 0 + 3 + 5 + 7 + 9 -> 24
sum of odd (5, 9) -> 5 + 7 + 9 -> 21
Code
Diff
  • const sumOdd = (min, max) => (++max / 2 | 0) ** 2 - (min / 2 | 0) ** 2;
    • sumNechet = (a, b) => (b/2).toFixed()**2;
    • const sumOdd = (min, max) => (++max / 2 | 0) ** 2 - (min / 2 | 0) ** 2;

Трубанов

Code
Diff
  • const tab = (f, a, b, h) => {
      let сумма = 0;
    
      for (let x = a; x <= b; x += h) {
        сумма += f(x);
      }
    
      return сумма;
    };
    • const tab = (f, a, b, h) => {
    • }
    • let сумма = 0;
    • for (let x = a; x <= b; x += h) {
    • сумма += f(x);
    • }
    • return сумма;
    • };