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
UnnamedFailed Tests

What?

import java.util.stream.Stream;

public class Main {
  public static Stream<String> foo() {
    return
      Stream.of("a").flatMap(_a ->
        Stream.of("b").flatMap(_b ->
          Stream.of("c-foo", "d", "d")));
  }
  
  public static Stream<String> bar() {
    return
      Stream.of("a").flatMap(_a ->
          Stream.iterate("c-bar", _x -> "d"));
  }
  
  public static Stream<String> baz() {
    return
      Stream.of("a").flatMap(_a ->
        Stream.of("b").flatMap(_b ->
          Stream.iterate("c-baz", _x -> "d")));
  }
}
package runtime;

public class Solution {
  public static long sum(int... nums) {
    long sum = 0;
    for (long l : nums) {
      sum += l;
    }
    return sum;
  }
}
krnl0138Failed Tests

moveZeros

Move all zeros to the end of array

var moveZeros = function (arr) {
   return arr.filter(el => el !== 0).concat(arr.filter(el => el === 0));
}

The function 'reverse' takes one parameter. Return the reversed parameter.

The parameter can be either an int or a string, and your return must be of the same type as the input.

reverse(1234) --> 4321
reverse('absfe') --> 'efsba'

def reverse(intOrStr):
    reversed = ''
    ss = ''
    if str(intOrStr) == intOrStr:
        for i in range(len(intOrStr)):
            reversed += intOrStr[len(intOrStr)-i-1]
        return reversed
    else: 
        ss = str(intOrStr)
        for i in range(len(ss)):
            reversed += ss[len(ss)-i-1]
        return int(reversed)
const parse = (value = '') => {
  if (/^[^@]+@[^@]+\.[a-zA-Z]{2,}$/.test(value)) {
    return true
  } else {
    return false
  }
}
function replaceAllInTextWith(text, search, textReplace) {
  return text.split(search).join(textReplace)
}

Sumar todos los numeros del occurs

IDENTIFICATION DIVISION.
       PROGRAM-ID. SOLUTION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-TABLE.
         05 WS-NUMBER PIC 9(02) OCCURS 5 TIMES INDEXED BY I.
       01 RESULT    PIC 9(04).
       
      
       PROCEDURE DIVISION.
           GOBACK.
       F01-SUM-OCCURS.
             PERFORM VARYING I FROM 1 BY 1 UNTIL I >5
             
                COMPUTE RESULT = RESULT + WS-NUMBER(I).
             
             END-PERFORM
             .

Return -1 if it's not possible to increase the number in this way. e.g. 11, 321

def next_bigger(num):
    digits = list(map(int, str(num)))
    
    best = [-1] * 10
    for i in range(len(digits)-1, -1, -1):
        val = digits[i]
        if not best[val] == -1:
            digits[i], digits[best[val]] = digits[best[val]], digits[i]
            return int(''.join(map(str, digits)))
        else:
            best = [i if (best[j] == -1 or val <= digits[best[j]]) and val > j else best[j] for j in range(len(best))]   
    return -1
Arrays
Data Types
Strings
Numbers

In this kata you must create a function that accepts strings as an input. The goal is to return the biggest and smallest numbers in order of greatest to least in an array. The input may contain non-numeric characters, so watch out. If a number is given as input the program should return an empty array.

Ex. "12382hgsjas//6" --> [8, 1]

Ex. 12324334 --> []

Ex. ["gr", "0", 578898, "12", "shthj680000001gh"] --> [680000001, 12]

Happy coding, and good luck!

def small_big_num(infos):
    if isinstance(infos, int): return []
    elif isinstance(infos, str):
        infos = [int(i) for i in infos if i.isdigit()]
        return [max(infos), min(infos)]
import analysis.special_functions.trigonometric

#check complex.continuous_cos